Commit c326b4ef authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

QA: Test more tag operations via RAPI



This ensures tag operations work via RAPI. Also print requested URI to
stdout for debugging.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent fd837171
......@@ -116,6 +116,7 @@ def _DoTests(uris):
for uri, verify, method, body in uris:
assert uri.startswith("/")
print "%s %s" % (method, uri)
data = _rapi_client._SendRequest(method, uri, None, body)
if verify is not None:
......@@ -259,10 +260,25 @@ def TestTags(kind, name, tags):
def _VerifyTags(data):
AssertEqual(sorted(tags), sorted(data))
query = "&".join("tag=%s" % i for i in tags)
# Add tags
(job_id, ) = _DoTests([
("%s?%s" % (uri, query), _VerifyReturnsJob, "PUT", None),
])
_WaitForRapiJob(job_id)
# Retrieve tags
_DoTests([
(uri, _VerifyTags, 'GET', None),
])
# Remove tags
(job_id, ) = _DoTests([
("%s?%s" % (uri, query), _VerifyReturnsJob, "DELETE", None),
])
_WaitForRapiJob(job_id)
def _WaitForRapiJob(job_id):
"""Waits for a job to finish.
......
......@@ -66,13 +66,13 @@ def _TestTags(kind, name):
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
if qa_rapi.Enabled():
qa_rapi.TestTags(kind, name, _TEMP_TAG_NAMES)
cmd = cmdfn('remove-tags') + _TEMP_TAG_NAMES
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
if qa_rapi.Enabled():
qa_rapi.TestTags(kind, name, _TEMP_TAG_NAMES)
def TestClusterTags():
"""gnt-cluster tags"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment