Skip to content

Commit ee35409

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Slow down and retry aggregate create/delete to lessen race"
2 parents bf52ae5 + 26c268a commit ee35409

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

openstackclient/tests/functional/compute/v2/test_aggregate.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# under the License.
1212

1313
import json
14+
import time
1415
import uuid
1516

1617
from openstackclient.tests.functional import base
@@ -51,6 +52,23 @@ def test_aggregate_create_and_delete(self):
5152
cmd_output['availability_zone']
5253
)
5354

55+
# Loop a few times since this is timing-sensitive
56+
# Just hard-code it for now, since there is no pause and it is
57+
# racy we shouldn't have to wait too long, a minute seems reasonable
58+
wait_time = 0
59+
while wait_time < 60:
60+
cmd_output = json.loads(self.openstack(
61+
'aggregate show -f json ' +
62+
name2
63+
))
64+
if cmd_output['name'] != name2:
65+
# Hang out for a bit and try again
66+
print('retrying aggregate check')
67+
wait_time += 10
68+
time.sleep(10)
69+
else:
70+
break
71+
5472
del_output = self.openstack(
5573
'aggregate delete ' +
5674
name1 + ' ' +

0 commit comments

Comments
 (0)