mirror of https://github.com/docker/compose.git
Change version check from engine version to api version.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
0fed5e6864
commit
f7100b2ef3
|
@ -187,7 +187,7 @@ class CLITestCase(DockerClientTestCase):
|
|||
)
|
||||
|
||||
def test_up_without_networking(self):
|
||||
self.require_engine_version("1.9")
|
||||
self.require_api_version('1.21')
|
||||
|
||||
self.command.base_dir = 'tests/fixtures/links-composefile'
|
||||
self.command.dispatch(['up', '-d'], None)
|
||||
|
@ -205,7 +205,7 @@ class CLITestCase(DockerClientTestCase):
|
|||
self.assertTrue(web_container.get('HostConfig.Links'))
|
||||
|
||||
def test_up_with_networking(self):
|
||||
self.require_engine_version("1.9")
|
||||
self.require_api_version('1.21')
|
||||
|
||||
self.command.base_dir = 'tests/fixtures/links-composefile'
|
||||
self.command.dispatch(['--x-networking', 'up', '-d'], None)
|
||||
|
|
|
@ -98,14 +98,14 @@ class ProjectTest(DockerClientTestCase):
|
|||
self.assertEqual(db._get_volumes_from(), [data_container.id + ':rw'])
|
||||
|
||||
def test_get_network_does_not_exist(self):
|
||||
self.require_engine_version("1.9")
|
||||
self.require_api_version('1.21')
|
||||
client = docker_client(version='1.21')
|
||||
|
||||
project = Project('composetest', [], client)
|
||||
assert project.get_network() is None
|
||||
|
||||
def test_get_network(self):
|
||||
self.require_engine_version("1.9")
|
||||
self.require_api_version('1.21')
|
||||
client = docker_client(version='1.21')
|
||||
|
||||
network_name = 'network_does_exist'
|
||||
|
|
|
@ -76,11 +76,7 @@ class DockerClientTestCase(unittest.TestCase):
|
|||
build_output = self.client.build(*args, **kwargs)
|
||||
stream_output(build_output, open('/dev/null', 'w'))
|
||||
|
||||
def require_engine_version(self, minimum):
|
||||
# Drop '-dev' or '-rcN' suffix
|
||||
engine = self.client.version()['Version'].split('-', 1)[0]
|
||||
if version_lt(engine, minimum):
|
||||
skip(
|
||||
"Engine version is too low ({} < {})"
|
||||
.format(engine, minimum)
|
||||
)
|
||||
def require_api_version(self, minimum):
|
||||
api_version = self.client.version()['ApiVersion']
|
||||
if version_lt(api_version, minimum):
|
||||
skip("API version is too low ({} < {})".format(api_version, minimum))
|
||||
|
|
Loading…
Reference in New Issue