Skip to content

Commit

Permalink
Adjust tests for API 1.45
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed May 22, 2024
1 parent 2857570 commit 03a2b47
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tests/integration/models_containers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'}
),
}
Expand All @@ -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)

Expand Down

0 comments on commit 03a2b47

Please sign in to comment.