From a587753481176ee6de7eb41201842b335d75a7d9 Mon Sep 17 00:00:00 2001 From: Michele Tartara <mtartara@google.com> Date: Fri, 10 May 2013 10:07:07 +0000 Subject: [PATCH] Add QA for instance status collector This commit introduces the QA for the instance status collector. Begin the first QA for a monitoring-related component, the files and some functions are named after monitoring because they are meant to contain future monitoring QAs as well. Signed-off-by: Michele Tartara <mtartara@google.com> Reviewed-by: Klaus Aehlig <aehlig@google.com> --- Makefile.am | 1 + qa/ganeti-qa.py | 8 +++++++ qa/qa-sample.json | 4 +++- qa/qa_monitoring.py | 55 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 qa/qa_monitoring.py diff --git a/Makefile.am b/Makefile.am index a821efe37..4721836f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -778,6 +778,7 @@ qa_scripts = \ qa/qa_instance.py \ qa/qa_instance_utils.py \ qa/qa_job.py \ + qa/qa_monitoring.py \ qa/qa_node.py \ qa/qa_os.py \ qa/qa_rapi.py \ diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index eeee93527..f30436eb0 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -38,6 +38,7 @@ import qa_env import qa_error import qa_group import qa_instance +import qa_monitoring import qa_network import qa_node import qa_os @@ -687,6 +688,11 @@ def RunInstanceTests(): qa_cluster.AssertClusterVerify() +def RunMonitoringTests(): + if qa_config.TestEnabled("mon-collector"): + RunTest(qa_monitoring.TestInstStatusCollector) + + def RunQa(): """Main QA body. @@ -809,6 +815,8 @@ def RunQa(): snode.Release() qa_cluster.AssertClusterVerify() + RunMonitoringTests() + RunTestIf("create-cluster", qa_node.TestNodeRemoveAll) RunTestIf("cluster-destroy", qa_cluster.TestClusterDestroy) diff --git a/qa/qa-sample.json b/qa/qa-sample.json index 851a3b123..ac6c258c3 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -228,7 +228,9 @@ "# Run instance tests with different cluster configurations": null, "default-instance-tests": true, - "exclusive-storage-instance-tests": false + "exclusive-storage-instance-tests": false, + + "mon-collector": true }, "options": { diff --git a/qa/qa_monitoring.py b/qa/qa_monitoring.py new file mode 100644 index 000000000..d6a270911 --- /dev/null +++ b/qa/qa_monitoring.py @@ -0,0 +1,55 @@ +# +# + +# Copyright (C) 2007, 2011, 2012, 2013 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + + +"""Monitoring related QA tests. + +""" + +from ganeti import _autoconf + +import qa_config + +from qa_utils import AssertCommand +from qa_instance_utils import CreateInstanceByDiskTemplate, \ + RemoveInstance + +MON_COLLECTOR = _autoconf.PKGLIBDIR + "/mon-collector" + + +def TestInstStatusCollector(): + """Test the Xen instance status collector. + + """ + # Execute on master on an empty cluster + AssertCommand([MON_COLLECTOR, "inst-status-xen"]) + + #Execute on cluster with instances + node1 = qa_config.AcquireNode() + node2 = qa_config.AcquireNode() + template = qa_config.GetDefaultDiskTemplate() + + instance = CreateInstanceByDiskTemplate([node1, node2], template) + AssertCommand([MON_COLLECTOR, "inst-status-xen"], node=node1) + AssertCommand([MON_COLLECTOR, "inst-status-xen"], node=node2) + RemoveInstance(instance) + + node1.Release() + node2.Release() -- GitLab