Fix IPv6 standalone network plugin test

StandaloneNetworkPluginTest.test_init_only_with_required_data_v6 fails
on some platforms because of the formatting of IPv6 addresses.

Currently, the test expects ('2001:cdba::', '2001:cdba::3257:9652',
'2001:cdba:0:ffff:ffff:ffff:ffff:ffff') as reserved_addresses.
This fails on platforms which format IPv6 addresses differently (e.g.
the last address as '2001:cdba::ffff:ffff:ffff:ffff:ffff', where the
zero in the middle is missing).

By packing that address into a netaddr.IPAddress object and formatting
it, this issue can be resolved.

Change-Id: I36376d373b325c2d34b301f866536bc5d54e202b
Closes-Bug: #1578738
This commit is contained in:
Daniel Gonzalez 2016-05-04 23:27:13 +02:00
parent 9604cca6b2
commit 7ca05d5f6e

View File

@ -124,7 +124,8 @@ class StandaloneNetworkPluginTest(test.TestCase):
['2001:cdba::3257:9652/48'], instance.allowed_cidrs)
self.assertEqual(
('2001:cdba::', '2001:cdba::3257:9652',
'2001:cdba:0:ffff:ffff:ffff:ffff:ffff'),
netaddr.IPAddress('2001:cdba:0:ffff:ffff:ffff:ffff:ffff').format()
),
instance.reserved_addresses)
@ddt.data('custom_config_group_name', 'DEFAULT')