From d0cb68cb3e525b340ae58f35c436391d4a3726ac Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Wed, 20 Oct 2010 14:04:32 +0200
Subject: [PATCH] =?UTF-8?q?QA:=20Add=20test=20for=20=E2=80=9Cgnt-node=20mo?=
 =?UTF-8?q?dify=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 qa/ganeti-qa.py   | 14 ++++++++------
 qa/qa-sample.json |  1 +
 qa/qa_node.py     | 17 +++++++++++++++++
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 4f51c78c3..23586ce1f 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -363,13 +363,15 @@ def main():
   if qa_config.TestEnabled('tags'):
     RunTest(qa_tags.TestClusterTags)
 
-  if qa_config.TestEnabled('node-readd'):
-    master = qa_config.GetMasterNode()
-    pnode = qa_config.AcquireNode(exclude=master)
-    try:
+  pnode = qa_config.AcquireNode(exclude=qa_config.GetMasterNode())
+  try:
+    if qa_config.TestEnabled('node-readd'):
       RunTest(qa_node.TestNodeReadd, pnode)
-    finally:
-      qa_config.ReleaseNode(pnode)
+
+    if qa_config.TestEnabled("node-modify"):
+      RunTest(qa_node.TestNodeModify, pnode)
+  finally:
+    qa_config.ReleaseNode(pnode)
 
   pnode = qa_config.AcquireNode()
   try:
diff --git a/qa/qa-sample.json b/qa/qa-sample.json
index 6bfd42cab..824cf7865 100644
--- a/qa/qa-sample.json
+++ b/qa/qa-sample.json
@@ -55,6 +55,7 @@
     "node-volumes": true,
     "node-readd": true,
     "node-storage": true,
+    "node-modify": true,
 
     "# This test needs at least three nodes": null,
     "node-evacuate": false,
diff --git a/qa/qa_node.py b/qa/qa_node.py
index 025683c1c..15550f954 100644
--- a/qa/qa_node.py
+++ b/qa/qa_node.py
@@ -219,3 +219,20 @@ def TestNodeEvacuate(node, node2):
                          utils.ShellQuoteArgs(cmd)).wait(), 0)
   finally:
     qa_config.ReleaseNode(node3)
+
+
+def TestNodeModify(node):
+  """gnt-node modify"""
+  master = qa_config.GetMasterNode()
+
+  for flag in ["master-candidate", "drained", "offline"]:
+    for value in ["yes", "no"]:
+      cmd = ["gnt-node", "modify", "--force",
+             "--%s=%s" % (flag, value), node["primary"]]
+      AssertEqual(StartSSH(master["primary"],
+                           utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+  cmd = ["gnt-node", "modify", "--master-candidate=yes", "--auto-promote",
+         node["primary"]]
+  AssertEqual(StartSSH(master["primary"],
+                       utils.ShellQuoteArgs(cmd)).wait(), 0)
-- 
GitLab