diff options
Diffstat (limited to 'openstackclient/tests/functional/compute')
3 files changed, 62 insertions, 12 deletions
diff --git a/openstackclient/tests/functional/compute/v2/test_aggregate.py b/openstackclient/tests/functional/compute/v2/test_aggregate.py index cf9d2bc0..71026757 100644 --- a/openstackclient/tests/functional/compute/v2/test_aggregate.py +++ b/openstackclient/tests/functional/compute/v2/test_aggregate.py @@ -11,6 +11,7 @@ # under the License. import json +import time import uuid from openstackclient.tests.functional import base @@ -51,6 +52,23 @@ class AggregateTests(base.TestCase): cmd_output['availability_zone'] ) + # Loop a few times since this is timing-sensitive + # Just hard-code it for now, since there is no pause and it is + # racy we shouldn't have to wait too long, a minute seems reasonable + wait_time = 0 + while wait_time < 60: + cmd_output = json.loads(self.openstack( + 'aggregate show -f json ' + + name2 + )) + if cmd_output['name'] != name2: + # Hang out for a bit and try again + print('retrying aggregate check') + wait_time += 10 + time.sleep(10) + else: + break + del_output = self.openstack( 'aggregate delete ' + name1 + ' ' + diff --git a/openstackclient/tests/functional/compute/v2/test_flavor.py b/openstackclient/tests/functional/compute/v2/test_flavor.py index eefd3fab..c274adf2 100644 --- a/openstackclient/tests/functional/compute/v2/test_flavor.py +++ b/openstackclient/tests/functional/compute/v2/test_flavor.py @@ -112,8 +112,7 @@ class FlavorTests(base.TestCase): 0, cmd_output["disk"], ) - self.assertEqual( - False, + self.assertFalse( cmd_output["os-flavor-access:is_public"], ) self.assertEqual( @@ -199,8 +198,7 @@ class FlavorTests(base.TestCase): 20, cmd_output["disk"], ) - self.assertEqual( - False, + self.assertFalse( cmd_output["os-flavor-access:is_public"], ) self.assertEqual( diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py index 0b29fe5f..3cb72d9f 100644 --- a/openstackclient/tests/functional/compute/v2/test_server.py +++ b/openstackclient/tests/functional/compute/v2/test_server.py @@ -11,6 +11,7 @@ # under the License. import json +import time import uuid from tempest.lib import exceptions @@ -255,10 +256,24 @@ class ServerTests(common.ComputeTestCase): floating_ip ) self.assertEqual("", raw_output) - cmd_output = json.loads(self.openstack( - 'server show -f json ' + - name - )) + + # Loop a few times since this is timing-sensitive + # Just hard-code it for now, since there is no pause and it is + # racy we shouldn't have to wait too long, a minute seems reasonable + wait_time = 0 + while wait_time < 60: + cmd_output = json.loads(self.openstack( + 'server show -f json ' + + name + )) + if floating_ip not in cmd_output['addresses']: + # Hang out for a bit and try again + print('retrying floating IP check') + wait_time += 10 + time.sleep(10) + else: + break + self.assertIn( floating_ip, cmd_output['addresses'], @@ -272,6 +287,23 @@ class ServerTests(common.ComputeTestCase): ) self.assertEqual("", raw_output) + # Loop a few times since this is timing-sensitive + # Just hard-code it for now, since there is no pause and it is + # racy we shouldn't have to wait too long, a minute seems reasonable + wait_time = 0 + while wait_time < 60: + cmd_output = json.loads(self.openstack( + 'server show -f json ' + + name + )) + if floating_ip in cmd_output['addresses']: + # Hang out for a bit and try again + print('retrying floating IP check') + wait_time += 10 + time.sleep(10) + else: + break + cmd_output = json.loads(self.openstack( 'server show -f json ' + name @@ -586,7 +618,9 @@ class ServerTests(common.ComputeTestCase): server_name ) except exceptions.CommandFailed as e: - self.assertIn('nics are required after microversion 2.36', - e.stderr) - else: - self.fail('CommandFailed should be raised.') + # If we got here, it shouldn't be because a nics value wasn't + # provided to the server; it is likely due to something else in + # the functional tests like there being multiple available + # networks and the test didn't specify a specific network. + self.assertNotIn('nics are required after microversion 2.36', + e.stderr) |
