Add messages about skipped QA disk template tests
authorHrvoje Ribicic <riba@google.com>
Thu, 3 Apr 2014 11:14:27 +0000 (11:14 +0000)
committerHrvoje Ribicic <riba@google.com>
Fri, 4 Apr 2014 09:10:55 +0000 (11:10 +0200)
When disk templates were ignored in the QA, no messages were emitted,
in contrast to pretty much all tests. To make it easier to see why
a test was not executed, this patch performs a minor refactoring and
adds some output for the templates.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

qa/ganeti-qa.py

index 38659b8..f21768a 100755 (executable)
@@ -100,6 +100,22 @@ def RunTest(fn, *args, **kwargs):
     print _FormatHeader("%s time=%s %s" % (tstop, tdelta, desc))
 
 
+def ReportTestSkip(desc, testnames):
+  """Reports that tests have been skipped.
+
+  @type desc: string
+  @param desc: string
+  @type testnames: string or list of string
+  @param testnames: either a single test name in the configuration
+      file, or a list of testnames (which will be AND-ed together)
+
+  """
+  tstart = datetime.datetime.now()
+  # TODO: Formatting test names when non-string names are involved
+  print _FormatHeader("%s skipping %s, test(s) %s disabled" %
+                      (tstart, desc, testnames))
+
+
 def RunTestIf(testnames, fn, *args, **kwargs):
   """Runs a test conditionally.
 
@@ -110,11 +126,8 @@ def RunTestIf(testnames, fn, *args, **kwargs):
   if qa_config.TestEnabled(testnames):
     RunTest(fn, *args, **kwargs)
   else:
-    tstart = datetime.datetime.now()
     desc = _DescriptionOf(fn)
-    # TODO: Formatting test names when non-string names are involved
-    print _FormatHeader("%s skipping %s, test(s) %s disabled" %
-                        (tstart, desc, testnames))
+    ReportTestSkip(desc, testnames)
 
 
 def RunEnvTests():
@@ -758,6 +771,12 @@ def RunInstanceTests():
       finally:
         qa_config.ReleaseManyNodes(inodes)
       qa_cluster.AssertClusterVerify()
+    else:
+      test_desc = "Creating instances of template %s" % templ
+      if not qa_config.TestEnabled(test_name):
+        ReportTestSkip(test_desc, test_name)
+      else:
+        ReportTestSkip(test_desc, "disk template %s" % templ)
 
 
 def RunMonitoringTests():