Commit e5c2accd authored by Guido Trotter's avatar Guido Trotter
Browse files

Simplify instance rename qa test



The current instance rename qa testing function can only perform
back-and-forth renames, both for command line and rapi. In order to be
able to perform same-name rename tests we change it to be able to
perform simple renames, and then we change qa to call it to perform both
sides of the renaming.

The same change is applied both to the local and the rapi test.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 2db12a5a
......@@ -199,14 +199,17 @@ def RunCommonInstanceTests(instance):
RunTestIf("instance-reboot", qa_instance.TestInstanceReboot, instance)
if qa_config.TestEnabled('instance-rename'):
rename_source = instance["name"]
rename_target = qa_config.get("rename", None)
if rename_target is None:
print qa_utils.FormatError("Can rename instance, 'rename' entry is"
" missing from configuration")
else:
RunTest(qa_instance.TestInstanceShutdown, instance)
RunTest(qa_instance.TestInstanceRename, instance, rename_target)
RunTestIf("rapi", qa_rapi.TestRapiInstanceRename, instance, rename_target)
RunTest(qa_instance.TestInstanceRename, rename_source, rename_target)
RunTest(qa_instance.TestInstanceRename, rename_target, rename_source)
RunTestIf("rapi", qa_rapi.TestRapiInstanceRename, rename_source, rename_target)
RunTestIf("rapi", qa_rapi.TestRapiInstanceRename, rename_target, rename_source)
RunTest(qa_instance.TestInstanceStartup, instance)
RunTestIf("tags", qa_tags.TestInstanceTags, instance)
......
......@@ -133,15 +133,11 @@ def _CheckSsconfInstanceList(instance):
_ReadSsconfInstanceList())
def TestInstanceRename(instance, rename_target):
def TestInstanceRename(rename_source, rename_target):
"""gnt-instance rename"""
rename_source = instance['name']
for name1, name2 in [(rename_source, rename_target),
(rename_target, rename_source)]:
_CheckSsconfInstanceList(name1)
AssertCommand(["gnt-instance", "rename", name1, name2])
_CheckSsconfInstanceList(name2)
_CheckSsconfInstanceList(rename_source)
AssertCommand(["gnt-instance", "rename", rename_source, rename_target])
_CheckSsconfInstanceList(rename_target)
def TestInstanceFailover(instance):
......
......@@ -402,13 +402,9 @@ def TestRapiInstanceMigrate(instance):
_WaitForRapiJob(_rapi_client.MigrateInstance(instance["name"]))
def TestRapiInstanceRename(instance, rename_target):
def TestRapiInstanceRename(rename_source, rename_target):
"""Test renaming instance via RAPI"""
rename_source = instance["name"]
for name1, name2 in [(rename_source, rename_target),
(rename_target, rename_source)]:
_WaitForRapiJob(_rapi_client.RenameInstance(name1, name2))
_WaitForRapiJob(_rapi_client.RenameInstance(rename_source, rename_target))
def TestRapiInstanceModify(instance):
......
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