Add acceptance test for use-aliases feature

Signed-off-by: Jim Dalton <jim.dalton@gmail.com>
This commit is contained in:
Jim Dalton 2017-05-10 13:28:40 +02:00 committed by Joffrey F
parent 5b6e02d13a
commit e78c0bf533
1 changed files with 22 additions and 0 deletions

View File

@ -1903,6 +1903,28 @@ class CLITestCase(DockerClientTestCase):
container = service.containers(stopped=True, one_off=True)[0]
assert workdir == container.get('Config.WorkingDir')
@v2_only()
def test_run_service_with_use_aliases(self):
filename = 'network-aliases.yml'
self.base_dir = 'tests/fixtures/networks'
self.dispatch(['-f', filename, 'run', '-d', '--use-aliases', 'web', 'top'])
back_name = '{}_back'.format(self.project.name)
front_name = '{}_front'.format(self.project.name)
web_container = self.project.get_service('web').containers(one_off=OneOffFilter.only)[0]
back_aliases = web_container.get(
'NetworkSettings.Networks.{}.Aliases'.format(back_name)
)
assert 'web' in back_aliases
front_aliases = web_container.get(
'NetworkSettings.Networks.{}.Aliases'.format(front_name)
)
assert 'web' in front_aliases
assert 'forward_facing' in front_aliases
assert 'ahead' in front_aliases
@v2_only()
def test_run_interactive_connects_to_network(self):
self.base_dir = 'tests/fixtures/networks'