From 09470dd825e59110293a6b2a93631e23431efaec Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 28 Mar 2012 14:31:46 +0200 Subject: [PATCH] =?UTF-8?q?QA:=20Add=20tests=20for=20=E2=80=9Cgnt-job=20li?= =?UTF-8?q?st=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> --- Makefile.am | 1 + qa/ganeti-qa.py | 6 ++++++ qa/qa-sample.json | 2 ++ qa/qa_job.py | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 qa/qa_job.py diff --git a/Makefile.am b/Makefile.am index ad1b009b3..f769518b3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -506,6 +506,7 @@ qa_scripts = \ qa/qa_error.py \ qa/qa_group.py \ qa/qa_instance.py \ + qa/qa_job.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 dc815da67..29262025e 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -38,6 +38,7 @@ import qa_group import qa_instance import qa_node import qa_os +import qa_job import qa_rapi import qa_tags import qa_utils @@ -130,6 +131,7 @@ def SetupCluster(rapi_user, rapi_secret): # Test on empty cluster RunTestIf("node-list", qa_node.TestNodeList) RunTestIf("instance-list", qa_instance.TestInstanceList) + RunTestIf("job-list", qa_job.TestJobList) RunTestIf("create-cluster", qa_node.TestNodeAddAll) if not qa_config.TestEnabled("create-cluster"): @@ -146,6 +148,7 @@ def SetupCluster(rapi_user, rapi_secret): # Test listing fields RunTestIf("node-list", qa_node.TestNodeListFields) RunTestIf("instance-list", qa_instance.TestInstanceListFields) + RunTestIf("job-list", qa_job.TestJobListFields) RunTestIf("node-info", qa_node.TestNodeInfo) @@ -290,6 +293,9 @@ def RunCommonInstanceTests(instance): # Lists instances, too RunTestIf("node-list", qa_node.TestNodeList) + # Some jobs have been run, let's test listing them + RunTestIf("job-list", qa_job.TestJobList) + def RunCommonNodeTests(): """Run a few common node tests. diff --git a/qa/qa-sample.json b/qa/qa-sample.json index d8bccb299..7ec51a866 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -113,6 +113,8 @@ "instance-rename": true, "instance-shutdown": true, + "job-list": true, + "# cron/ganeti-watcher should be disabled for these tests": null, "instance-automatic-restart": false, "instance-consecutive-failures": false, diff --git a/qa/qa_job.py b/qa/qa_job.py new file mode 100644 index 000000000..e464f7489 --- /dev/null +++ b/qa/qa_job.py @@ -0,0 +1,38 @@ +# +# + +# Copyright (C) 2012 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. + + +"""Job-related QA tests. + +""" + +from ganeti import query + +import qa_utils + + +def TestJobList(): + """gnt-job list""" + qa_utils.GenericQueryTest("gnt-job", query.JOB_FIELDS.keys()) + + +def TestJobListFields(): + """gnt-node list-fields""" + qa_utils.GenericQueryFieldsTest("gnt-job", query.JOB_FIELDS.keys()) -- GitLab