@@ -104,6 +104,7 @@ def test_run_with_network(self):
104
104
assert 'Networks' in attrs ['NetworkSettings' ]
105
105
assert list (attrs ['NetworkSettings' ]['Networks' ].keys ()) == [net_name ]
106
106
107
+ @requires_api_version ('1.32' )
107
108
def test_run_with_networking_config (self ):
108
109
net_name = random_name ()
109
110
client = docker .from_env (version = TEST_API_VERSION )
@@ -132,11 +133,12 @@ def test_run_with_networking_config(self):
132
133
assert 'NetworkSettings' in attrs
133
134
assert 'Networks' in attrs ['NetworkSettings' ]
134
135
assert list (attrs ['NetworkSettings' ]['Networks' ].keys ()) == [net_name ]
135
- assert attrs [ 'NetworkSettings' ][ 'Networks' ][ net_name ][ 'Aliases' ] == \
136
- test_aliases
136
+ for alias in test_aliases :
137
+ assert alias in attrs [ 'NetworkSettings' ][ 'Networks' ][ net_name ][ 'Aliases' ]
137
138
assert attrs ['NetworkSettings' ]['Networks' ][net_name ]['DriverOpts' ] \
138
139
== test_driver_opt
139
140
141
+ @requires_api_version ('1.32' )
140
142
def test_run_with_networking_config_with_undeclared_network (self ):
141
143
net_name = random_name ()
142
144
client = docker .from_env (version = TEST_API_VERSION )
@@ -165,6 +167,7 @@ def test_run_with_networking_config_with_undeclared_network(self):
165
167
)
166
168
self .tmp_containers .append (container .id )
167
169
170
+ @requires_api_version ('1.32' )
168
171
def test_run_with_networking_config_only_undeclared_network (self ):
169
172
net_name = random_name ()
170
173
client = docker .from_env (version = TEST_API_VERSION )
@@ -190,9 +193,11 @@ def test_run_with_networking_config_only_undeclared_network(self):
190
193
assert 'NetworkSettings' in attrs
191
194
assert 'Networks' in attrs ['NetworkSettings' ]
192
195
assert list (attrs ['NetworkSettings' ]['Networks' ].keys ()) == [net_name ]
193
- assert attrs ['NetworkSettings' ]['Networks' ][net_name ]['Aliases' ] is None
194
196
assert (attrs ['NetworkSettings' ]['Networks' ][net_name ]['DriverOpts' ]
195
197
is None )
198
+ # Aliases should include the container's short-id (but it will be removed
199
+ # in API v1.45).
200
+ assert attrs ['NetworkSettings' ]['Networks' ][net_name ]['Aliases' ] == [attrs ["Id" ][:12 ]]
196
201
197
202
def test_run_with_none_driver (self ):
198
203
client = docker .from_env (version = TEST_API_VERSION )
0 commit comments