Commit 80009a71 authored by Michael Hanselmann's avatar Michael Hanselmann

QA: Use constants instead of hardcoded numbers

Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent ee7f592e
......@@ -38,6 +38,10 @@ from qa_utils import AssertCommand
_TEMP_OS_PATH = os.path.join(constants.OS_SEARCH_PATH[0], _TEMP_OS_NAME)
_PARTIALLY_VALID) = range(1, 4)
def TestOsList():
"""gnt-os list"""
......@@ -120,15 +124,17 @@ def _TestOs(mode):
for i, node in enumerate(qa_config.get("nodes")):
if mode == 0:
if mode == _ALL_INVALID:
valid = False
elif mode == 1:
elif mode == _ALL_VALID:
valid = True
elif mode == _PARTIALLY_VALID:
valid = bool(i % 2)
raise AssertionError("Unknown mode %s" % mode)
_SetupTempOs(node, dirname, valid)
AssertCommand(["gnt-os", "diagnose"], fail=not mode==1)
AssertCommand(["gnt-os", "diagnose"], fail=(mode != _ALL_VALID))
for node in nodes:
_RemoveTempOs(node, dirname)
......@@ -136,17 +142,17 @@ def _TestOs(mode):
def TestOsValid():
"""Testing valid OS definition"""
return _TestOs(1)
return _TestOs(_ALL_VALID)
def TestOsInvalid():
"""Testing invalid OS definition"""
return _TestOs(0)
return _TestOs(_ALL_INVALID)
def TestOsPartiallyValid():
"""Testing partially valid OS definition"""
return _TestOs(2)
return _TestOs(_PARTIALLY_VALID)
def TestOsModifyValid():
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