From 4674714333daa961b8b19bc799779b5d6787a9be Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Thu, 9 Dec 2010 11:45:22 +0100
Subject: [PATCH] qa: test same-name instance rename

Use the simplified command and rapi version to perform an instance
rename to the same name. This is performed anytime the rename test is
enabled, while the "other-name" rename is performed when also an
alternative name is provided.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 qa/ganeti-qa.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 1c2f74635..027c06590 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -201,16 +201,17 @@ def RunCommonInstanceTests(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.TestInstanceShutdown, instance)
+    # perform instance rename to the same name
+    RunTest(qa_instance.TestInstanceRename, rename_source, rename_source)
+    RunTestIf("rapi", qa_rapi.TestRapiInstanceRename, rename_source, rename_source)
+    if rename_target is not None:
+      # perform instance rename to a different name, if we have one configured
       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)
+    RunTest(qa_instance.TestInstanceStartup, instance)
 
   RunTestIf("tags", qa_tags.TestInstanceTags, instance)
 
-- 
GitLab