From 617eb742ab9426a769e9859b569b54b260025a39 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Sat, 15 Jul 2017 18:01:19 -0400 Subject: [PATCH] Adjust test_resize_down_revert to account for counting quotas Change I9269ffa2b80e48db96c622d0dc0817738854f602 in the Nova server removes the need for reservations, which means that once the server is resized in nova-compute and the vcpus and memory_mb are changed on the instances record, the usage count will also change, before the resize is confirmed. This means we need to adjust the usage assertions in the resize down test. Usage changes once the server is in VERIFY_RESIZE state, and the usage will change again if the resize is reverted. Note that if we were getting usage without the 'reserved' query paramter to the 'limits' API, the behavior would have been the same regardless of the change to Nova for counting quotas. Depends-On: I9269ffa2b80e48db96c622d0dc0817738854f602 Related to blueprint cells-count-resources-to-check-quota-in-api Change-Id: I91ca0d204454987dcce1c68d9bf0f532b469df6d --- novaclient/tests/functional/v2/test_resize.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/novaclient/tests/functional/v2/test_resize.py b/novaclient/tests/functional/v2/test_resize.py index 25526024f..9277480ea 100644 --- a/novaclient/tests/functional/v2/test_resize.py +++ b/novaclient/tests/functional/v2/test_resize.py @@ -135,17 +135,16 @@ class TestServersResize(base.ClientTestBase): self.nova('resize', params='%s %s --poll' % (server_id, smaller_flavor)) resize_usage = self._get_absolute_limits() - # compare the starting usage against the resize usage; in the case of - # a resize down we don't expect usage to change until it's confirmed, - # which doesn't happen in this test since we revert - self._compare_quota_usage( - starting_usage, resize_usage, expect_diff=False) + # compare the starting usage against the resize usage; with counting + # quotas in the server there are no reservations, so the + # usage changes after the resize happens before it's confirmed. + self._compare_quota_usage(starting_usage, resize_usage) # now revert the resize self.nova('resize-revert', params='%s' % server_id) # we have to wait for the server to be ACTIVE before we can check quota self._wait_for_state_change(server_id, 'active') - # get the final quota usage which should be the same as the resize - # usage before revert + # get the final quota usage which will be different from the resize + # usage since we've reverted back *up* to the original flavor; the API + # code checks quota again if we revert up in size revert_usage = self._get_absolute_limits() - self._compare_quota_usage( - resize_usage, revert_usage, expect_diff=False) + self._compare_quota_usage(resize_usage, revert_usage)