Fix #2804: Add ipv4 and ipv6 static addressing
- Added ipv4_network and ipv6_network to the networks section in the service section for each configured network - Added feature documentation - Added unit tests Signed-off-by: Matt Daue <mattdaue@gmail.com>
This commit is contained in:
parent
8a86e204a0
commit
ee136446a2
8 changed files with 178 additions and 9 deletions
|
|
@ -475,6 +475,30 @@ class CLITestCase(DockerClientTestCase):
|
|||
assert 'forward_facing' in front_aliases
|
||||
assert 'ahead' in front_aliases
|
||||
|
||||
@v2_only()
|
||||
def test_up_with_network_static_addresses(self):
|
||||
filename = 'network-static-addresses.yml'
|
||||
ipv4_address = '172.16.100.100'
|
||||
ipv6_address = 'fe80::1001:100'
|
||||
self.base_dir = 'tests/fixtures/networks'
|
||||
self.dispatch(['-f', filename, 'up', '-d'], None)
|
||||
static_net = '{}_static_test'.format(self.project.name)
|
||||
|
||||
networks = [
|
||||
n for n in self.client.networks()
|
||||
if n['Name'].startswith('{}_'.format(self.project.name))
|
||||
]
|
||||
|
||||
# One networks was created: front
|
||||
assert sorted(n['Name'] for n in networks) == [static_net]
|
||||
web_container = self.project.get_service('web').containers()[0]
|
||||
|
||||
ipam_config = web_container.get(
|
||||
'NetworkSettings.Networks.{}.IPAMConfig'.format(static_net)
|
||||
)
|
||||
assert ipv4_address in ipam_config.values()
|
||||
assert ipv6_address in ipam_config.values()
|
||||
|
||||
@v2_only()
|
||||
def test_up_with_networks(self):
|
||||
self.base_dir = 'tests/fixtures/networks'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue