[openstack-dev] Problem with test_quotas.py in master branch

Jay Pipes jaypipes at gmail.com
Fri Feb 8 01:09:12 UTC 2013


On 02/07/2013 03:48 PM, Nathan P Biles wrote:
> I think I found a bug in tempest/tests/compute/test_quotas.py. It should
> be using assertEquals in test_get_default_quotas:
> 
>             self.assertEqual(expected_quota_set, quota_set)
>             #self.assertSequenceEqual(expected_quota_set, quota_set)
> 
> Iadded some prints to dump the two objects and they are failing to
> report equal on my system because they are out of order, but all with
> the same values:
> 
> expected_quota_set:{'metadata_items': 128, 'ram': 51200,
> 'security_group_rules': 20, 'instances': 10, 'key_pairs': 100, 'id':
> '450174c5232148c89c8879325f00b73e', 'security_groups': 10,
> 'injected_file_content_bytes': 10240, 'floating_ips': 9,
> 'injected_files': 5, 'cores': 20, 'injected_file_path_bytes': 255}
> 
> quota_set:{'injected_file_content_bytes': 10240, 'metadata_items': 128,
> 'ram': 51200, 'floating_ips': 10, 'key_pairs': 100,
> 'injected_file_path_bytes': 255, 'instances': 10,
> 'security_group_rules': 20, 'injected_files': 5, 'cores': 20, 'id':
> '450174c5232148c89c8879325f00b73e', 'security_groups': 10}
> 
> But just using equals fixes it (the test passes when it should, and
> fails if I change one of the expected values in the 'set').
> 
> Does anyone know if sequence is really important here... should we
> change it to use equals, or does it need to be checking the sequence too
> (not sure that is even possible)?

Hi Nathan, thanks for contributing to Tempest. The returned result from
the os-quota-sets extension is a dict, not a list, and therefore, there
is no reason to care about the order of keys in the result.

There is an assertDictEquals() method of unittest2.TestCase that should
be able to be used for this, unless of course doing so would be
incompatible with our use of testtools.TestCase...

Best,
-jay




More information about the OpenStack-dev mailing list