Revision b4d2d2cb
b/qa/qa_group.py | ||
---|---|---|
43 | 43 |
|
44 | 44 |
def TestGroupAddRemoveRename(): |
45 | 45 |
"""gnt-group add/remove/rename""" |
46 |
groups = qa_config.get("groups", {}) |
|
47 |
|
|
48 | 46 |
existing_group_with_nodes = GetDefaultGroup() |
49 | 47 |
|
50 |
group1, group2, group3 = groups.get("inexistent-groups", |
|
51 |
["group1", "group2", "group3"])[:3] |
|
48 |
(group1, group2, group3) = qa_utils.GetNonexistentGroups(3) |
|
52 | 49 |
|
53 | 50 |
AssertCommand(["gnt-group", "add", group1]) |
54 | 51 |
AssertCommand(["gnt-group", "add", group2]) |
... | ... | |
71 | 68 |
|
72 | 69 |
def TestGroupAddWithOptions(): |
73 | 70 |
"""gnt-group add with options""" |
74 |
groups = qa_config.get("groups", {}) |
|
75 |
group1 = groups.get("inexistent-groups", ["group1"])[0] |
|
71 |
(group1, ) = qa_utils.GetNonexistentGroups(1) |
|
76 | 72 |
|
77 | 73 |
AssertCommand(["gnt-group", "add", "--alloc-policy", "notvalid", group1], |
78 | 74 |
fail=True) |
... | ... | |
85 | 81 |
|
86 | 82 |
def TestGroupModify(): |
87 | 83 |
"""gnt-group modify""" |
88 |
groups = qa_config.get("groups", {}) |
|
89 |
group1 = groups.get("inexistent-groups", ["group1"])[0] |
|
84 |
(group1, ) = qa_utils.GetNonexistentGroups(1) |
|
90 | 85 |
|
91 | 86 |
AssertCommand(["gnt-group", "add", group1]) |
92 | 87 |
|
... | ... | |
130 | 125 |
|
131 | 126 |
""" |
132 | 127 |
assert node1 != node2 |
133 |
groups = qa_config.get("groups", {}) |
|
134 |
other_group = groups.get("inexistent-groups", ["group1"])[0]
|
|
128 |
|
|
129 |
(other_group, ) = qa_utils.GetNonexistentGroups(1)
|
|
135 | 130 |
|
136 | 131 |
master_node = qa_config.GetMasterNode()["primary"] |
137 | 132 |
|
b/qa/qa_rapi.py | ||
---|---|---|
492 | 492 |
"""Test several node group operations using RAPI. |
493 | 493 |
|
494 | 494 |
""" |
495 |
groups = qa_config.get("groups", {}) |
|
496 |
group1, group2, group3 = groups.get("inexistent-groups", |
|
497 |
["group1", "group2", "group3"])[:3] |
|
495 |
(group1, group2, group3) = qa_utils.GetNonexistentGroups(3) |
|
498 | 496 |
|
499 | 497 |
# Create a group with no attributes |
500 | 498 |
body = { |
b/qa/qa_utils.py | ||
---|---|---|
647 | 647 |
return result |
648 | 648 |
return wrapper |
649 | 649 |
return decorator |
650 |
|
|
651 |
|
|
652 |
def GetNonexistentGroups(count): |
|
653 |
"""Gets group names which shouldn't exist on the cluster. |
|
654 |
|
|
655 |
@param count: Number of groups to get |
|
656 |
@rtype: list |
|
657 |
|
|
658 |
""" |
|
659 |
groups = qa_config.get("groups", {}) |
|
660 |
|
|
661 |
default = ["group1", "group2", "group3"] |
|
662 |
assert count <= len(default) |
|
663 |
|
|
664 |
candidates = groups.get("inexistent-groups", default)[:count] |
|
665 |
|
|
666 |
if len(candidates) < count: |
|
667 |
raise Exception("At least %s non-existent groups are needed" % count) |
|
668 |
|
|
669 |
return candidates |
Also available in: Unified diff