Merge "Full response for DataProcessingClient methods"
diff --git a/tempest/scenario/test_dashboard_basic_ops.py b/tempest/scenario/test_dashboard_basic_ops.py
index eb018eb..8e91a6d 100644
--- a/tempest/scenario/test_dashboard_basic_ops.py
+++ b/tempest/scenario/test_dashboard_basic_ops.py
@@ -26,6 +26,7 @@
class HorizonHTMLParser(HTMLParser.HTMLParser):
csrf_token = None
region = None
+ login = None
def _find_name(self, attrs, name):
for attrpair in attrs:
@@ -39,12 +40,20 @@
return attrpair[1]
return None
+ def _find_attr_value(self, attrs, attr_name):
+ for attrpair in attrs:
+ if attrpair[0] == attr_name:
+ return attrpair[1]
+ return None
+
def handle_starttag(self, tag, attrs):
if tag == 'input':
if self._find_name(attrs, 'csrfmiddlewaretoken'):
self.csrf_token = self._find_value(attrs)
if self._find_name(attrs, 'region'):
self.region = self._find_value(attrs)
+ if tag == 'form':
+ self.login = self._find_attr_value(attrs, 'action')
class TestDashboardBasicOps(manager.ScenarioTest):
@@ -79,8 +88,12 @@
parser = HorizonHTMLParser()
parser.feed(response)
+ # construct login url for dashboard, discovery accomodates non-/ web
+ # root for dashboard
+ login_url = CONF.dashboard.dashboard_url + parser.login[1:]
+
# Prepare login form request
- req = request.Request(CONF.dashboard.login_url)
+ req = request.Request(login_url)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
req.add_header('Referer', CONF.dashboard.dashboard_url)
params = {'username': username,
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index f61b151..3019cc4 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -16,6 +16,7 @@
from oslo_log import log as logging
from tempest import config
+from tempest import exceptions
from tempest.scenario import manager
from tempest.scenario import utils as test_utils
from tempest import test
@@ -98,9 +99,24 @@
def verify_metadata(self):
if self.run_ssh and CONF.compute_feature_enabled.metadata_service:
# Verify metadata service
- result = self.ssh_client.exec_command(
- "curl http://169.254.169.254/latest/meta-data/public-ipv4")
- self.assertEqual(self.floating_ip['ip'], result)
+ md_url = 'http://169.254.169.254/latest/meta-data/public-ipv4'
+
+ def exec_cmd_and_verify_output():
+ cmd = 'curl ' + md_url
+ floating_ip = self.floating_ip['ip']
+ result = self.ssh_client.exec_command(cmd)
+ if result:
+ msg = ('Failed while verifying metadata on server. Result '
+ 'of command "%s" is NOT "%s".' % (cmd, floating_ip))
+ self.assertEqual(floating_ip, result, msg)
+ return 'Verification is successful!'
+
+ if not test.call_until_true(exec_cmd_and_verify_output,
+ CONF.compute.build_timeout,
+ CONF.compute.build_interval):
+ raise exceptions.TimeoutException('Timed out while waiting to '
+ 'verify metadata on server. '
+ '%s is empty.' % md_url)
@test.idempotent_id('7fff3fb3-91d8-4fd0-bd7d-0204f1f180ba')
@test.attr(type='smoke')
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index a99a1f5..f523f11 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -206,15 +206,7 @@
post_body)
if response_key is not None:
body = json.loads(body)
- # Check for Schema as 'None' because if we do not have any server
- # action schema implemented yet then they can pass 'None' to skip
- # the validation.Once all server action has their schema
- # implemented then, this check can be removed if every actions are
- # supposed to validate their response.
- # TODO(GMann): Remove the below 'if' check once all server actions
- # schema are implemented.
- if schema is not None:
- self.validate_response(schema, resp, body)
+ self.validate_response(schema, resp, body)
body = body[response_key]
else:
self.validate_response(schema, resp, body)