Add wait for async secgroup add to minimum basic scenario
Security group add actions are asynchronous so we can't assume that
the security will be available immediately to ssh into the server.
This commit fixes the issue by adding a wait for the secgroup to show
up in the server before we move on.
Fixes-bug: 1390355
Change-Id: Idd561d77ce2e4b83421bb7bfb6327a6c940b62ed
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 8a8e387..3725477 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -16,6 +16,7 @@
from tempest.common import custom_matchers
from tempest.common import debug
from tempest import config
+from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest import test
@@ -130,6 +131,17 @@
self.addCleanup(self.servers_client.remove_security_group,
self.server['id'], secgroup['name'])
+ def wait_for_secgroup_add():
+ _, body = self.servers_client.get_server(self.server['id'])
+ return {'name': secgroup['name']} in body['security_groups']
+
+ if not test.call_until_true(wait_for_secgroup_add,
+ CONF.compute.build_timeout,
+ CONF.compute.build_interval):
+ msg = ('Timed out waiting for adding security group %s to server '
+ '%s' % (secgroup['id'], self.server['id']))
+ raise exceptions.TimeoutException(msg)
+
@test.services('compute', 'volume', 'image', 'network')
def test_minimum_basic_scenario(self):
self.glance_image_create()