From e822689ca13d4c44a26c6ff2cc2dced5ca1de6d3 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Fri, 16 Jan 2015 14:01:56 -0500 Subject: [PATCH] test for non-existance of tag changed to be more strict to the tags form i.e. check for tag_*_* form rather than tag_* tag_none grouping is more like ec2 global groups. Thus, removed the children filter test. --- awx/main/tests/inventory.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/tests/inventory.py b/awx/main/tests/inventory.py index 2583c95334..1f01de6f7d 100644 --- a/awx/main/tests/inventory.py +++ b/awx/main/tests/inventory.py @@ -1606,7 +1606,7 @@ class InventoryUpdatesTest(BaseTransactionTest): self.assertFalse(name.startswith('type_')) self.assertFalse(name.startswith('key_')) self.assertFalse(name.startswith('security_group_')) - self.assertFalse(name.startswith('tag_')) + self.assertFalse(re.search(r'tag_.*?_', name)) self.assertFalse(name.startswith('ami-')) self.assertFalse(name.startswith('vpc-')) self.assertTrue('ec2' in child_names) @@ -1616,6 +1616,7 @@ class InventoryUpdatesTest(BaseTransactionTest): self.assertTrue('security_groups' in child_names) self.assertTrue('tags' in child_names) self.assertTrue('images' in child_names) + self.assertTrue('tag_none' in child_names) self.assertFalse('instances' in child_names) # Make sure we clean up the cache path when finished (when one is not # provided explicitly via source_vars). @@ -1645,7 +1646,7 @@ class InventoryUpdatesTest(BaseTransactionTest): # Sync again with group_by set to include all possible groups. cache_path2 = tempfile.mkdtemp(prefix='awx_ec2_') self._temp_paths.append(cache_path2) - inventory_source.group_by = 'instance_id, region, availability_zone, ami_id, instance_type, key_pair, vpc_id, security_group, tag_keys' + inventory_source.group_by = 'instance_id, region, availability_zone, ami_id, instance_type, key_pair, vpc_id, security_group, tag_keys, tag_none' inventory_source.source_vars = '---\n\ncache_path: %s\n' % cache_path2 inventory_source.overwrite = True inventory_source.save() @@ -1654,6 +1655,7 @@ class InventoryUpdatesTest(BaseTransactionTest): # Skip vpcs as selected inventory may or may not have any. child_names = self.group.children.filter(active=True).values_list('name', flat=True) self.assertTrue('ec2' in child_names) + self.assertTrue('tag_none' in child_names) self.assertTrue('regions' in child_names) self.assertTrue(self.group.children.get(name='regions').children.filter(active=True).count()) self.assertTrue('types' in child_names)