Commit 66787da5 authored by Adeodato Simo's avatar Adeodato Simo
Browse files

Group operations: add QA tests for add/remove/rename



This is a single function that tests all of of the following:

  - creating groups
  - creating groups that exist fails
  - renaming an empty group
  - renaming a group with nodes
  - renaming to a name that already exists fails
  - removing an empty group works
  - removing a group with nodes fails

The "default" group is only used for the "rename group with nodes"
test.
Signed-off-by: default avatarAdeodato Simo <dato@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent a268af8d
......@@ -230,6 +230,12 @@ def RunGroupListTests():
RunTestIf("group-list", qa_group.TestGroupListAllFields)
def RunGroupRwTests():
"""Run tests for adding/removing/renaming groups.
"""
RunTestIf("group-rwops", qa_group.TestGroupAddRemoveRename)
def RunExportImportTests(instance, pnode, snode):
"""Tries to export and import the instance.
......@@ -358,6 +364,7 @@ def main():
RunCommonNodeTests()
RunGroupListTests()
RunGroupRwTests()
pnode = qa_config.AcquireNode(exclude=qa_config.GetMasterNode())
try:
......
......@@ -33,6 +33,15 @@
}
],
"groups": {
"group-with-nodes": "default",
"inexistent-groups": [
"group1",
"group2",
"group3"
]
}
"tests": {
"env": true,
"os": true,
......@@ -54,6 +63,7 @@
"cluster-modify": true,
"group-list": true,
"group-rwops": true,
"node-info": true,
"node-volumes": true,
......
......@@ -19,9 +19,37 @@
# 02110-1301, USA.
import qa_config
from qa_utils import AssertCommand
def TestGroupAddRemoveRename():
"""gnt-group add/remove/rename"""
groups = qa_config.get("groups", {})
existing_group_with_nodes = groups.get("group-with-nodes", "default")
group1, group2, group3 = groups.get("inexistent-groups",
["group1", "group2", "group3"])[:3]
AssertCommand(["gnt-group", "add", group1])
AssertCommand(["gnt-group", "add", group2])
AssertCommand(["gnt-group", "add", group2], fail=True)
AssertCommand(["gnt-group", "add", existing_group_with_nodes], fail=True)
AssertCommand(["gnt-group", "rename", group1, group2], fail=True)
AssertCommand(["gnt-group", "rename", group1, group3])
try:
AssertCommand(["gnt-group", "rename", existing_group_with_nodes, group1])
AssertCommand(["gnt-group", "remove", group2])
AssertCommand(["gnt-group", "remove", group3])
AssertCommand(["gnt-group", "remove", group1], fail=True)
finally:
# Try to ensure idempotency re groups that already existed.
AssertCommand(["gnt-group", "rename", group1, existing_group_with_nodes])
def TestGroupListDefaultFields():
"""gnt-group list"""
AssertCommand(["gnt-group", "list"])
......
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