From fe508a9dd6fbb1353d4b23cb80ef0be119508a95 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 21 Apr 2011 12:58:53 +0200 Subject: [PATCH] QA: Add tests for node group tags Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- qa/ganeti-qa.py | 2 ++ qa/qa_group.py | 12 ++++++++++-- qa/qa_rapi.py | 2 ++ qa/qa_tags.py | 6 ++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index d77a4f751..cb22862c2 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -298,6 +298,8 @@ def RunGroupRwTests(): RunTestIf("group-rwops", qa_group.TestGroupAddWithOptions) RunTestIf("group-rwops", qa_group.TestGroupModify) RunTestIf(["group-rwops", "rapi"], qa_rapi.TestRapiNodeGroups) + RunTestIf(["group-rwops", "tags"], qa_tags.TestGroupTags, + qa_group.GetDefaultGroup()) def RunExportImportTests(instance, pnode, snode): diff --git a/qa/qa_group.py b/qa/qa_group.py index 290f837a1..e09c2f8a2 100644 --- a/qa/qa_group.py +++ b/qa/qa_group.py @@ -33,12 +33,20 @@ import qa_utils from qa_utils import AssertCommand, AssertEqual, GetCommandOutput +def GetDefaultGroup(): + """Returns the default node group. + + """ + groups = qa_config.get("groups", {}) + return groups.get("group-with-nodes", constants.INITIAL_NODE_GROUP_NAME) + + def TestGroupAddRemoveRename(): """gnt-group add/remove/rename""" groups = qa_config.get("groups", {}) - existing_group_with_nodes = groups.get("group-with-nodes", - constants.INITIAL_NODE_GROUP_NAME) + existing_group_with_nodes = GetDefaultGroup() + group1, group2, group3 = groups.get("inexistent-groups", ["group1", "group2", "group3"])[:3] diff --git a/qa/qa_rapi.py b/qa/qa_rapi.py index 8232b9352..cdf454a44 100644 --- a/qa/qa_rapi.py +++ b/qa/qa_rapi.py @@ -415,6 +415,8 @@ def TestTags(kind, name, tags): uri = "/2/nodes/%s/tags" % name elif kind == constants.TAG_INSTANCE: uri = "/2/instances/%s/tags" % name + elif kind == constants.TAG_NODEGROUP: + uri = "/2/groups/%s/tags" % name else: raise errors.ProgrammerError("Unknown tag kind") diff --git a/qa/qa_tags.py b/qa/qa_tags.py index 9e48696d6..a4350aa3e 100644 --- a/qa/qa_tags.py +++ b/qa/qa_tags.py @@ -34,6 +34,7 @@ _KIND_TO_COMMAND = { constants.TAG_CLUSTER: "gnt-cluster", constants.TAG_NODE: "gnt-node", constants.TAG_INSTANCE: "gnt-instance", + constants.TAG_NODEGROUP: "gnt-group", } @@ -71,6 +72,11 @@ def TestNodeTags(node): _TestTags(constants.TAG_NODE, node["primary"]) +def TestGroupTags(group): + """gnt-group tags""" + _TestTags(constants.TAG_NODEGROUP, group) + + def TestInstanceTags(instance): """gnt-instance tags""" _TestTags(constants.TAG_INSTANCE, instance["name"]) -- GitLab