From 8a4e889805438f6d249ded03387d948cc56275a9 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 6 Jun 2008 09:31:54 +0000
Subject: [PATCH] =?UTF-8?q?Forward-port:=20Add=20QA=20tests=20for=20?=
 =?UTF-8?q?=E2=80=9Cgnt-instance=20reboot=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: ultrotter
---
 qa/ganeti-qa.py   |  3 +++
 qa/qa-sample.yaml |  1 +
 qa/qa_instance.py | 12 ++++++++++++
 3 files changed, 16 insertions(+)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 469a18673..3278c1a18 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -151,6 +151,9 @@ def RunCommonInstanceTests(instance):
     RunTest(qa_instance.TestInstanceReinstall, instance)
     RunTest(qa_instance.TestInstanceStartup, instance)
 
+  if qa_config.TestEnabled('instance-reboot'):
+    RunTest(qa_instance.TestInstanceReboot, instance)
+
   if qa_config.TestEnabled('tags'):
     RunTest(qa_tags.TestInstanceTags, instance)
 
diff --git a/qa/qa-sample.yaml b/qa/qa-sample.yaml
index 223854109..8d31c9541 100644
--- a/qa/qa-sample.yaml
+++ b/qa/qa-sample.yaml
@@ -61,6 +61,7 @@ tests:
   instance-export: True
   instance-import: True
   instance-reinstall: True
+  instance-reboot: True
   instance-shutdown: True
   instance-automatic-restart: False
   instance-consecutive-failures: False
diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index e9ea78853..ae35bf99c 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -111,6 +111,18 @@ def TestInstanceShutdown(instance):
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
 
+@qa_utils.DefineHook('instance-reboot')
+def TestInstanceReboot(instance):
+  """gnt-instance reboot"""
+  master = qa_config.GetMasterNode()
+
+  for reboottype in ["soft", "hard", "full"]:
+    cmd = ['gnt-instance', 'reboot', '--type=%s' % reboottype,
+           instance['name']]
+    AssertEqual(StartSSH(master['primary'],
+                         utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+
 @qa_utils.DefineHook('instance-reinstall')
 def TestInstanceReinstall(instance):
   """gnt-instance reinstall"""
-- 
GitLab