From 9b3939eaf061d11b681aae999bed18ae564ac9c4 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 22 Nov 2007 14:11:26 +0000
Subject: [PATCH] Call more hooks during QA tests.

Reviewed-by: schreiberal
---
 qa/qa_daemon.py | 2 ++
 qa/qa_env.py    | 4 ++++
 qa/qa_os.py     | 5 +++++
 qa/qa_tags.py   | 3 +++
 4 files changed, 14 insertions(+)

diff --git a/qa/qa_daemon.py b/qa/qa_daemon.py
index 6d0d70676..7223068fb 100644
--- a/qa/qa_daemon.py
+++ b/qa/qa_daemon.py
@@ -101,6 +101,7 @@ def PrintCronWarning():
   print qa_utils.FormatWarning(msg)
 
 
+@qa_utils.DefineHook('daemon-automatic-restart')
 def TestInstanceAutomaticRestart(node, instance):
   """Test automatic restart of instance by ganeti-watcher.
 
@@ -122,6 +123,7 @@ def TestInstanceAutomaticRestart(node, instance):
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
 
+@qa_utils.DefineHook('daemon-consecutive-failures')
 def TestInstanceConsecutiveFailures(node, instance):
   """Test five consecutive instance failures.
 
diff --git a/qa/qa_env.py b/qa/qa_env.py
index 266fb111e..86ad5909a 100644
--- a/qa/qa_env.py
+++ b/qa/qa_env.py
@@ -23,10 +23,12 @@
 from ganeti import utils
 
 import qa_config
+import qa_utils
 
 from qa_utils import AssertEqual, StartSSH
 
 
+@qa_utils.DefineHook('env-ssh-connection')
 def TestSshConnection():
   """Test SSH connection.
 
@@ -35,6 +37,7 @@ def TestSshConnection():
     AssertEqual(StartSSH(node['primary'], 'exit').wait(), 0)
 
 
+@qa_utils.DefineHook('env-ganeti-commands')
 def TestGanetiCommands():
   """Test availibility of Ganeti commands.
 
@@ -53,6 +56,7 @@ def TestGanetiCommands():
     AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
 
 
+@qa_utils.DefineHook('env-icmp-ping')
 def TestIcmpPing():
   """ICMP ping each node.
 
diff --git a/qa/qa_os.py b/qa/qa_os.py
index 957b97d18..16d77df99 100644
--- a/qa/qa_os.py
+++ b/qa/qa_os.py
@@ -36,6 +36,7 @@ _TEMP_OS_NAME = "TEMP-Ganeti-QA-OS"
 _TEMP_OS_PATH = os.path.join(constants.OS_SEARCH_PATH[0], _TEMP_OS_NAME)
 
 
+@qa_utils.DefineHook('os-list')
 def TestOsList():
   """gnt-os list"""
   master = qa_config.GetMasterNode()
@@ -45,6 +46,7 @@ def TestOsList():
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
 
+@qa_utils.DefineHook('os-diagnose')
 def TestOsDiagnose():
   """gnt-os diagnose"""
   master = qa_config.GetMasterNode()
@@ -123,16 +125,19 @@ def _TestOs(mode):
       _RemoveTempOs(node, dir)
 
 
+@qa_utils.DefineHook('os-valid')
 def TestOsValid():
   """Testing valid OS definition"""
   return _TestOs(1)
 
 
+@qa_utils.DefineHook('os-invalid')
 def TestOsInvalid():
   """Testing invalid OS definition"""
   return _TestOs(0)
 
 
+@qa_utils.DefineHook('os-partially-valid')
 def TestOsPartiallyValid():
   """Testing partially valid OS definition"""
   return _TestOs(2)
diff --git a/qa/qa_tags.py b/qa/qa_tags.py
index 6f1cb2975..9770288b0 100644
--- a/qa/qa_tags.py
+++ b/qa/qa_tags.py
@@ -55,16 +55,19 @@ def _TestTags(cmdfn):
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
 
+@qa_utils.DefineHook('tags-cluster')
 def TestClusterTags():
   """gnt-cluster tags"""
   _TestTags(lambda subcmd: ['gnt-cluster', subcmd])
 
 
+@qa_utils.DefineHook('tags-node')
 def TestNodeTags(node):
   """gnt-node tags"""
   _TestTags(lambda subcmd: ['gnt-node', subcmd, node['primary']])
 
 
+@qa_utils.DefineHook('tags-instance')
 def TestInstanceTags(instance):
   """gnt-instance tags"""
   _TestTags(lambda subcmd: ['gnt-instance', subcmd, instance['name']])
-- 
GitLab