From e1df06f210d0bd6adb8fa9732aedefe67daae14f Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 21 Sep 2010 13:50:07 +0200
Subject: [PATCH] Add some trivial QA tests for the new OS states

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 qa/ganeti-qa.py |  3 ++-
 qa/qa_os.py     | 21 ++++++++++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 4b784901e..070a1b34a 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 #
 
-# Copyright (C) 2007 Google Inc.
+# Copyright (C) 2007, 2008, 2009, 2010 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -145,6 +145,7 @@ def RunOsTests():
   RunTest(qa_os.TestOsPartiallyValid)
   RunTest(qa_os.TestOsModifyValid)
   RunTest(qa_os.TestOsModifyInvalid)
+  RunTest(qa_os.TestOsStates)
 
 
 def RunCommonInstanceTests(instance):
diff --git a/qa/qa_os.py b/qa/qa_os.py
index 28c2c7360..143fedc53 100644
--- a/qa/qa_os.py
+++ b/qa/qa_os.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2007 Google Inc.
+# Copyright (C) 2007, 2008, 2009, 2010 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -75,6 +75,19 @@ def _TestOsModify(hvp_dict, expected_result=0):
                        utils.ShellQuoteArgs(cmd)).wait(), expected_result)
 
 
+def _TestOsStates():
+  """gnt-os modify, more stuff"""
+  master = qa_config.GetMasterNode()
+
+  cmd = ["gnt-os", "modify"]
+
+  for param in ["hidden", "blacklisted"]:
+    for val in ["yes", "no"]:
+      new_cmd = cmd + ["--%s" % param, val, _TEMP_OS_NAME]
+      AssertEqual(StartSSH(master["primary"],
+                           utils.ShellQuoteArgs(new_cmd)).wait(), 0)
+
+
 def _SetupTempOs(node, dir, valid):
   """Creates a temporary OS definition on the given node.
 
@@ -181,3 +194,9 @@ def TestOsModifyInvalid():
     }
 
   return _TestOsModify(hv_dict, 1)
+
+
+def TestOsStates():
+  """Testing OS states"""
+
+  return _TestOsStates()
-- 
GitLab