Commit 51131cad authored by Michael Hanselmann's avatar Michael Hanselmann

QA: Cleanup after commit 5fa0375e

Some tests had wrong assumptions on the instance status and some
needed explicit start or stop commands.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent e78a6817
...@@ -265,10 +265,6 @@ def RunCommonInstanceTests(instance): ...@@ -265,10 +265,6 @@ def RunCommonInstanceTests(instance):
RunTestIf("instance-reinstall", qa_instance.TestInstanceReinstall, instance) RunTestIf("instance-reinstall", qa_instance.TestInstanceReinstall, instance)
RunTestIf(["instance-reinstall", "rapi"], RunTestIf(["instance-reinstall", "rapi"],
qa_rapi.TestRapiInstanceReinstall, instance) qa_rapi.TestRapiInstanceReinstall, instance)
# RAPI reinstall will leave the instance up by default, so we have
# to stop it again
RunTestIf(["instance-reinstall", "rapi"],
qa_rapi.TestRapiInstanceShutdown, instance)
if qa_config.TestEnabled("instance-rename"): if qa_config.TestEnabled("instance-rename"):
rename_source = instance["name"] rename_source = instance["name"]
...@@ -356,6 +352,8 @@ def RunExportImportTests(instance, pnode, snode): ...@@ -356,6 +352,8 @@ def RunExportImportTests(instance, pnode, snode):
try: try:
RunTest(qa_instance.TestInstanceImport, newinst, pnode, RunTest(qa_instance.TestInstanceImport, newinst, pnode,
expnode, name) expnode, name)
# Check if starting the instance works
RunTest(qa_instance.TestInstanceStartup, newinst)
RunTest(qa_instance.TestInstanceRemove, newinst) RunTest(qa_instance.TestInstanceRemove, newinst)
finally: finally:
qa_config.ReleaseInstance(newinst) qa_config.ReleaseInstance(newinst)
......
...@@ -156,7 +156,7 @@ def _CheckSsconfInstanceList(instance): ...@@ -156,7 +156,7 @@ def _CheckSsconfInstanceList(instance):
_ReadSsconfInstanceList()) _ReadSsconfInstanceList())
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG) @InstanceCheck(INST_DOWN, INST_DOWN, FIRST_ARG)
def TestInstanceRenameAndBack(rename_source, rename_target): def TestInstanceRenameAndBack(rename_source, rename_target):
"""gnt-instance rename """gnt-instance rename
...@@ -179,7 +179,7 @@ def TestInstanceRenameAndBack(rename_source, rename_target): ...@@ -179,7 +179,7 @@ def TestInstanceRenameAndBack(rename_source, rename_target):
AssertCommand(["gnt-instance", "rename", rename_source, rename_target]) AssertCommand(["gnt-instance", "rename", rename_source, rename_target])
_CheckSsconfInstanceList(rename_target) _CheckSsconfInstanceList(rename_target)
qa_utils.RunInstanceCheck(rename_source, False) qa_utils.RunInstanceCheck(rename_source, False)
qa_utils.RunInstanceCheck(rename_target, True) qa_utils.RunInstanceCheck(rename_target, False)
# and back # and back
AssertCommand(["gnt-instance", "rename", rename_target, rename_source]) AssertCommand(["gnt-instance", "rename", rename_target, rename_source])
...@@ -393,7 +393,7 @@ def TestInstanceExport(instance, node): ...@@ -393,7 +393,7 @@ def TestInstanceExport(instance, node):
return qa_utils.ResolveInstanceName(name) return qa_utils.ResolveInstanceName(name)
@InstanceCheck(INST_UP, None, FIRST_ARG) @InstanceCheck(None, INST_DOWN, FIRST_ARG)
def TestInstanceExportWithRemove(instance, node): def TestInstanceExportWithRemove(instance, node):
"""gnt-backup export --remove-instance""" """gnt-backup export --remove-instance"""
AssertCommand(["gnt-backup", "export", "-n", node["primary"], AssertCommand(["gnt-backup", "export", "-n", node["primary"],
...@@ -406,7 +406,7 @@ def TestInstanceExportNoTarget(instance): ...@@ -406,7 +406,7 @@ def TestInstanceExportNoTarget(instance):
AssertCommand(["gnt-backup", "export", instance["name"]], fail=True) AssertCommand(["gnt-backup", "export", instance["name"]], fail=True)
@InstanceCheck(None, INST_UP, FIRST_ARG) @InstanceCheck(None, INST_DOWN, FIRST_ARG)
def TestInstanceImport(newinst, node, expnode, name): def TestInstanceImport(newinst, node, expnode, name):
"""gnt-backup import""" """gnt-backup import"""
cmd = (["gnt-backup", "import", cmd = (["gnt-backup", "import",
......
...@@ -626,7 +626,7 @@ def TestRapiInstanceStartup(instance): ...@@ -626,7 +626,7 @@ def TestRapiInstanceStartup(instance):
_WaitForRapiJob(_rapi_client.StartupInstance(instance["name"])) _WaitForRapiJob(_rapi_client.StartupInstance(instance["name"]))
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG) @InstanceCheck(INST_DOWN, INST_DOWN, FIRST_ARG)
def TestRapiInstanceRenameAndBack(rename_source, rename_target): def TestRapiInstanceRenameAndBack(rename_source, rename_target):
"""Test renaming instance via RAPI """Test renaming instance via RAPI
...@@ -636,7 +636,7 @@ def TestRapiInstanceRenameAndBack(rename_source, rename_target): ...@@ -636,7 +636,7 @@ def TestRapiInstanceRenameAndBack(rename_source, rename_target):
""" """
_WaitForRapiJob(_rapi_client.RenameInstance(rename_source, rename_target)) _WaitForRapiJob(_rapi_client.RenameInstance(rename_source, rename_target))
qa_utils.RunInstanceCheck(rename_source, False) qa_utils.RunInstanceCheck(rename_source, False)
qa_utils.RunInstanceCheck(rename_target, True) qa_utils.RunInstanceCheck(rename_target, False)
_WaitForRapiJob(_rapi_client.RenameInstance(rename_target, rename_source)) _WaitForRapiJob(_rapi_client.RenameInstance(rename_target, rename_source))
qa_utils.RunInstanceCheck(rename_target, False) qa_utils.RunInstanceCheck(rename_target, False)
...@@ -645,6 +645,12 @@ def TestRapiInstanceRenameAndBack(rename_source, rename_target): ...@@ -645,6 +645,12 @@ def TestRapiInstanceRenameAndBack(rename_source, rename_target):
def TestRapiInstanceReinstall(instance): def TestRapiInstanceReinstall(instance):
"""Test reinstalling an instance via RAPI""" """Test reinstalling an instance via RAPI"""
_WaitForRapiJob(_rapi_client.ReinstallInstance(instance["name"])) _WaitForRapiJob(_rapi_client.ReinstallInstance(instance["name"]))
# By default, the instance is started again
qa_utils.RunInstanceCheck(instance, True)
# Reinstall again without starting
_WaitForRapiJob(_rapi_client.ReinstallInstance(instance["name"],
no_startup=True))
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG) @InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
......
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