From 9738ca9411995bb44aebd4e6049c09701fdae71d Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 17 Nov 2010 11:53:10 +0100 Subject: [PATCH] QA: add tests for gnt-cluster modify -B Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- qa/ganeti-qa.py | 4 ++++ qa/qa-sample.json | 1 + qa/qa_cluster.py | 30 +++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index 34e4787a5..7d62897c2 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -106,6 +106,10 @@ def RunClusterTests(): if qa_config.TestEnabled('cluster-reserved-lvs'): RunTest(qa_cluster.TestClusterReservedLvs) + if qa_config.TestEnabled("cluster-modify"): + RunTest(qa_cluster.TestClusterModifyBe) + # TODO: add more cluster modify tests + if qa_config.TestEnabled('cluster-rename'): RunTest(qa_cluster.TestClusterRename) diff --git a/qa/qa-sample.json b/qa/qa-sample.json index fe42edf56..56a8a2945 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -49,6 +49,7 @@ "cluster-destroy": true, "cluster-rename": true, "cluster-reserved-lvs": true, + "cluster-modify": true, "node-info": true, "node-volumes": true, diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index 7f47d2ecd..fc4e5e730 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2007 Google Inc. +# Copyright (C) 2007, 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 @@ -168,6 +168,34 @@ def TestClusterReservedLvs(): utils.ShellQuoteArgs(cmd)).wait(), rcode) +def TestClusterModifyBe(): + """gnt-cluster modify -B""" + master = qa_config.GetMasterNode() + + for rcode, cmd in [ + # mem + (0, ["gnt-cluster", "modify", "-B", "memory=256"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 256$'"]), + (1, ["gnt-cluster", "modify", "-B", "memory=a"]), + (0, ["gnt-cluster", "modify", "-B", "memory=128"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 128$'"]), + # vcpus + (0, ["gnt-cluster", "modify", "-B", "vcpus=4"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 4$'"]), + (1, ["gnt-cluster", "modify", "-B", "vcpus=a"]), + (0, ["gnt-cluster", "modify", "-B", "vcpus=1"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 1$'"]), + # auto_balance + (0, ["gnt-cluster", "modify", "-B", "auto_balance=False"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: False$'"]), + (1, ["gnt-cluster", "modify", "-B", "auto_balance=1"]), + (0, ["gnt-cluster", "modify", "-B", "auto_balance=True"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: True$'"]), + ]: + AssertEqual(StartSSH(master['primary'], + utils.ShellQuoteArgs(cmd)).wait(), rcode) + + def TestClusterInfo(): """gnt-cluster info""" master = qa_config.GetMasterNode() -- GitLab