From 03a2b47ce9214c767a13b814291cf909c5a0ca93 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 22 May 2024 15:41:46 +0200 Subject: [PATCH] Adjust tests for API 1.45 Signed-off-by: Sebastiaan van Stijn --- tests/integration/models_containers_test.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py index 476263ae2..639e9309f 100644 --- a/tests/integration/models_containers_test.py +++ b/tests/integration/models_containers_test.py @@ -131,9 +131,11 @@ def test_run_with_networking_config(self): assert 'NetworkSettings' in attrs assert 'Networks' in attrs['NetworkSettings'] assert list(attrs['NetworkSettings']['Networks'].keys()) == [net_name] - # Expect Aliases to list 'test_alias' and the container's short-id. - # In API version 1.45, the short-id will be removed. - assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] \ + # Aliases no longer include the container's short-id in API v1.45, + # and aliases are now included in DNSNames. + assert (attrs['NetworkSettings']['Networks'][net_name]['Aliases'] + is None) + assert attrs['NetworkSettings']['Networks'][net_name]['DNSNames'] \ == [test_alias, attrs['Id'][:12]] assert attrs['NetworkSettings']['Networks'][net_name]['DriverOpts'] \ == test_driver_opt @@ -172,9 +174,11 @@ def test_run_with_networking_config_only_undeclared_network(self): client.networks.create(net_name) self.tmp_networks.append(net_name) + test_alias = 'hello' + networking_config = { 'bar': client.api.create_endpoint_config( - aliases=['hello'], + aliases=[test_alias], driver_opt={'key1': 'a'} ), } @@ -191,9 +195,12 @@ def test_run_with_networking_config_only_undeclared_network(self): assert 'NetworkSettings' in attrs assert 'Networks' in attrs['NetworkSettings'] assert list(attrs['NetworkSettings']['Networks'].keys()) == [net_name] - # Aliases should include the container's short-id (but it will be removed - # in API v1.45). - assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] == [attrs["Id"][:12]] + # Aliases no longer include the container's short-id in API v1.45, + # and aliases are now included in DNSNames. + assert (attrs['NetworkSettings']['Networks'][net_name]['Aliases'] + is None) + assert attrs['NetworkSettings']['Networks'][net_name]['DNSNames'] \ + == [test_alias, attrs['Id'][:12]] assert (attrs['NetworkSettings']['Networks'][net_name]['DriverOpts'] is None)