mirror of https://github.com/docker/docker-py.git
Fix mac_address connect usage in network functions && addind appropriate test
Signed-off-by: Yuval Goldberg <yuvigoldi@hotmail.com>
This commit is contained in:
parent
755fd73566
commit
656db96b4a
|
@ -242,7 +242,8 @@ class NetworkApiMixin(object):
|
|||
"Container": container,
|
||||
"EndpointConfig": self.create_endpoint_config(
|
||||
aliases=aliases, links=links, ipv4_address=ipv4_address,
|
||||
ipv6_address=ipv6_address, link_local_ips=link_local_ips
|
||||
ipv6_address=ipv6_address, link_local_ips=link_local_ips,
|
||||
mac_address=mac_address
|
||||
),
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class EndpointConfig(dict):
|
|||
raise errors.InvalidVersion(
|
||||
'mac_address is not supported for API version < 1.25'
|
||||
)
|
||||
ipam_config['MacAddress'] = mac_address
|
||||
self['MacAddress'] = mac_address
|
||||
|
||||
if link_local_ips is not None:
|
||||
if version_lt(version, '1.24'):
|
||||
|
|
|
@ -387,6 +387,22 @@ class TestNetworks(BaseAPIIntegrationTest):
|
|||
net_data = container_data['NetworkSettings']['Networks'][net_name]
|
||||
assert net_data['IPAMConfig']['IPv6Address'] == '2001:389::f00d'
|
||||
|
||||
@requires_api_version('1.25')
|
||||
def test_connect_with_mac_address(self):
|
||||
net_name, net_id = self.create_network()
|
||||
|
||||
container = self.client.create_container(TEST_IMG, 'top')
|
||||
self.tmp_containers.append(container)
|
||||
|
||||
self.client.connect_container_to_network(
|
||||
container, net_name, mac_address='02:42:ac:11:00:02'
|
||||
)
|
||||
|
||||
container_data = self.client.inspect_container(container)
|
||||
|
||||
net_data = container_data['NetworkSettings']['Networks'][net_name]
|
||||
assert net_data['MacAddress'] == '02:42:ac:11:00:02'
|
||||
|
||||
@requires_api_version('1.23')
|
||||
def test_create_internal_networks(self):
|
||||
_, net_id = self.create_network(internal=True)
|
||||
|
|
Loading…
Reference in New Issue