Merge "Reduce reliance on global state for testing"
This commit is contained in:
commit
d469654d51
@ -16,6 +16,7 @@
|
|||||||
# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
|
# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import netaddr
|
import netaddr
|
||||||
@ -1079,7 +1080,7 @@ def main(all_args):
|
|||||||
backup_name = '%s-%s.json' % (basename, utctime)
|
backup_name = '%s-%s.json' % (basename, utctime)
|
||||||
tar.add(dynamic_inventory_file, arcname=backup_name)
|
tar.add(dynamic_inventory_file, arcname=backup_name)
|
||||||
else:
|
else:
|
||||||
dynamic_inventory = INVENTORY_SKEL
|
dynamic_inventory = copy.deepcopy(INVENTORY_SKEL)
|
||||||
|
|
||||||
# Save the users container cidr as a group variable
|
# Save the users container cidr as a group variable
|
||||||
cidr_networks = user_defined_config.get('cidr_networks')
|
cidr_networks = user_defined_config.get('cidr_networks')
|
||||||
|
@ -316,6 +316,10 @@ class TestIps(unittest.TestCase):
|
|||||||
"""Test that no duplicate IPs are made on any network."""
|
"""Test that no duplicate IPs are made on any network."""
|
||||||
|
|
||||||
for i in xrange(0, 99):
|
for i in xrange(0, 99):
|
||||||
|
# tearDown is ineffective for this loop, so clean the USED_IPs
|
||||||
|
# on each run
|
||||||
|
inventory = None
|
||||||
|
di.USED_IPS = []
|
||||||
inventory = get_inventory()
|
inventory = get_inventory()
|
||||||
ips = collections.defaultdict(int)
|
ips = collections.defaultdict(int)
|
||||||
hostvars = inventory['_meta']['hostvars']
|
hostvars = inventory['_meta']['hostvars']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user