From c326b4ef3069c5b8a9ff32a9eebf63f6c244245d Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 16 Sep 2010 12:46:32 +0200 Subject: [PATCH] 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: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- qa/qa_rapi.py | 16 ++++++++++++++++ qa/qa_tags.py | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/qa/qa_rapi.py b/qa/qa_rapi.py index 9ceca5f14..7e87ad2d1 100644 --- a/qa/qa_rapi.py +++ b/qa/qa_rapi.py @@ -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. diff --git a/qa/qa_tags.py b/qa/qa_tags.py index ae19f2e31..d438ab9ac 100644 --- a/qa/qa_tags.py +++ b/qa/qa_tags.py @@ -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""" -- GitLab