diff --git a/Makefile.am b/Makefile.am index a821efe3796eef17cf83fb9b0bcec0d63f0b16a3..4721836f7a5e408392dbd4309d4c037cbe516e9b 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 eeee935272546c24dfd07641007cf3f91507d52d..f30436eb070886bcb436868c29cdcf210c3be105 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 851a3b123e9f1f74960768748505e47c46617b09..ac6c258c3ca2551c71d1e5cc8335c98a0bb77df4 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 0000000000000000000000000000000000000000..d6a270911b8ad3642b077d08013927d8ebbe0250 --- /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()