raise qa_error.Error("%r == %r" % (first, second))
-def AssertNotEqual(first, second):
- """Raises an error when values are equal.
-
- """
- if not first != second:
- raise qa_error.Error("%r != %r" % (first, second))
-
-
def AssertMatch(string, pattern):
"""Raises an error when string doesn't match regexp pattern.
@param node: if passed, it should be the node on which the command
should be executed, instead of the master node (can be either a
dict or a string)
+ @return: the return code of the command
+ @raise qa_error.Error: if the command fails when it shouldn't or vice versa
"""
if node is None:
return result
return wrapper
return decorator
+
+
+def GetNonexistentGroups(count):
+ """Gets group names which shouldn't exist on the cluster.
+
+ @param count: Number of groups to get
+ @rtype: list
+
+ """
+ groups = qa_config.get("groups", {})
+
+ default = ["group1", "group2", "group3"]
+ assert count <= len(default)
+
+ candidates = groups.get("inexistent-groups", default)[:count]
+
+ if len(candidates) < count:
+ raise Exception("At least %s non-existent groups are needed" % count)
+
+ return candidates