[PATCH 1/3] Pass {runner,test}ClassAttrs to Creator instances.
by Chris Lumens
This allows tailoring those arguments to each test run within a suite, instead
of previously where every test had to accept the exact same set. This seems
to be a more flexible way of accomplishing the same thing.
---
tests/anaconda_storage/framework/cases/__init__.py | 18 ++++++++++++++++++
.../framework/suites/Ext2OnPartition.py | 9 +++++----
.../framework/suites/Ext3OnPartition.py | 9 +++++----
.../framework/suites/Ext4OnPartition.py | 9 +++------
.../anaconda_storage/framework/suites/__init__.py | 14 ++------------
5 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/tests/anaconda_storage/framework/cases/__init__.py b/tests/anaconda_storage/framework/cases/__init__.py
index 6f128fa..5493f86 100644
--- a/tests/anaconda_storage/framework/cases/__init__.py
+++ b/tests/anaconda_storage/framework/cases/__init__.py
@@ -103,13 +103,31 @@ class Creator:
directories needed to store disk images will also be created. Test
cases should not normally need to supply this method.
+ Required arguments:
+
+ name -- The name of this test case.
imagesdir -- The directory to use when creating disk images.
+ drives -- A list of paths to disk images that have previously been
+ created with qemu-img (or some other tool).
+
+ Arguments that may be passed via kwargs:
+
+ reqMemory -- The amount of memory the VM to run this test case
+ needs in MB, or 512 by default.
+ runnerClassAttrs -- A dict of attributes and values that will
+ be added to the RunnerClass that will be
+ executed by this test suite.
+ testClassAttrs -- The same as runnerClassAttrs, but for TestClass.
+ Most of the time, these two dicts will probably
+ need to be identical.
"""
self.drives = drives
self.imagesdir = imagesdir
self.name = name
self.reqMemory = kwargs.get("reqMemory", 512)
+ self.runnerClassAttrs = kwargs.get("runnerClassAttrs", {})
+ self.testClassAttrs = kwargs.get("testClassAttrs", {})
self._proc = None
diff --git a/tests/anaconda_storage/framework/suites/Ext2OnPartition.py b/tests/anaconda_storage/framework/suites/Ext2OnPartition.py
index 0620861..e788e6e 100644
--- a/tests/anaconda_storage/framework/suites/Ext2OnPartition.py
+++ b/tests/anaconda_storage/framework/suites/Ext2OnPartition.py
@@ -24,7 +24,8 @@ class Ext2OnPartitionTestSuite(Ext4OnPartition.Ext4OnPartitionTestSuite):
"""Test autopartitioning from a single blank drive."""
name = "ext2-on-partition"
- def __init__(self, *args, **kwargs):
- Ext4OnPartition.Ext4OnPartitionTestSuite.__init__(self, *args, **kwargs)
- self.runnerClassAttrs = {"fstype": "ext2"}
- self.testClassAttrs = {"fstype": "ext2"}
+ @property
+ def tests(self):
+ return [Creator("FSOnPartition", self.tempdir, self.drives,
+ runnerClassAttrs={"fstype": "ext2"},
+ testClassAttrs={"fstype": "ext2"})]
diff --git a/tests/anaconda_storage/framework/suites/Ext3OnPartition.py b/tests/anaconda_storage/framework/suites/Ext3OnPartition.py
index f751314..a5ea5f0 100644
--- a/tests/anaconda_storage/framework/suites/Ext3OnPartition.py
+++ b/tests/anaconda_storage/framework/suites/Ext3OnPartition.py
@@ -24,7 +24,8 @@ class Ext3OnPartitionTestSuite(Ext4OnPartition.Ext4OnPartitionTestSuite):
"""Test autopartitioning from a single blank drive."""
name = "ext3-on-partition"
- def __init__(self, *args, **kwargs):
- Ext4OnPartition.Ext4OnPartitionTestSuite.__init__(self, *args, **kwargs)
- self.runnerClassAttrs = {"fstype": "ext3"}
- self.testClassAttrs = {"fstype": "ext3"}
+ @property
+ def tests(self):
+ return [Creator("FSOnPartition", self.tempdir, self.drives,
+ runnerClassAttrs={"fstype": "ext3"},
+ testClassAttrs={"fstype": "ext3"})]
diff --git a/tests/anaconda_storage/framework/suites/Ext4OnPartition.py b/tests/anaconda_storage/framework/suites/Ext4OnPartition.py
index d93de31..8d79a9d 100644
--- a/tests/anaconda_storage/framework/suites/Ext4OnPartition.py
+++ b/tests/anaconda_storage/framework/suites/Ext4OnPartition.py
@@ -27,11 +27,6 @@ class Ext4OnPartitionTestSuite(BaseSuite):
"""Test autopartitioning from a single blank drive."""
name = "ext4-on-partition"
- def __init__(self, *args, **kwargs):
- BaseSuite.__init__(self, *args, **kwargs)
- self.runnerClassAttrs = {"fstype": "ext4"}
- self.testClassAttrs = {"fstype": "ext4"}
-
def setup(self):
(fd, diskimage) = tempfile.mkstemp(dir=self.tempdir)
os.close(fd)
@@ -41,4 +36,6 @@ class Ext4OnPartitionTestSuite(BaseSuite):
@property
def tests(self):
- return [Creator("FSOnPartition", self.tempdir, self.drives)]
+ return [Creator("FSOnPartition", self.tempdir, self.drives,
+ runnerClassAttrs={"fstype": "ext4"},
+ testClassAttrs={"fstype": "ext4"})]
diff --git a/tests/anaconda_storage/framework/suites/__init__.py b/tests/anaconda_storage/framework/suites/__init__.py
index 382d478..8779b38 100644
--- a/tests/anaconda_storage/framework/suites/__init__.py
+++ b/tests/anaconda_storage/framework/suites/__init__.py
@@ -71,21 +71,11 @@ class BaseSuite(object):
create these images and populate this list. It is not
necessary for test cases to use every single drive in
this list.
-
- runnerClassAttrs -- A dict of attributes and values that should
- be added to each RunnerClass that will be
- executed by this test suite.
- testClassAttrs -- The same as runnerClassAttrs, but for TestClass.
- Most of the time, these two dicts will probably
- need to be identical.
"""
self.basedir = basedir
self.diskimagesdir = diskimagesdir
self.drives = []
- self.runnerClassAttrs = {}
- self.testClassAttrs = {}
-
self._runningReportDir = None
self._runningTest = None
self._tempdir = None
@@ -146,9 +136,9 @@ class BaseSuite(object):
fo.write(fmt.format(s, module=obj.name.replace("TestSuite", ""),
reportDir=reportSubdir,
runnerClass=obj.name + "Runner",
- runnerClassAttrs=pickle.dumps(self.runnerClassAttrs),
+ runnerClassAttrs=pickle.dumps(obj.runnerClassAttrs),
testClass=obj.name + "TestCase",
- testClassAttrs=pickle.dumps(self.testClassAttrs),
+ testClassAttrs=pickle.dumps(obj.testClassAttrs),
token=token))
fo.close()
os.chmod(driverOut, 0755)
--
1.7.1.1
13 years, 2 months
[PATCH] no longer try to read config files from CWD
by Kamil Paral
We have improved our config files handling and now they are always
available at /etc/autoqa. We no longer need to try to load them from
CWD. Let's remove that code (less ambiguity).
---
lib/python/bodhi_utils.py | 2 +-
lib/python/config.py | 2 +-
lib/python/repoinfo.py | 3 +--
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/python/bodhi_utils.py b/lib/python/bodhi_utils.py
index 2df40f8..92ccb2f 100644
--- a/lib/python/bodhi_utils.py
+++ b/lib/python/bodhi_utils.py
@@ -38,7 +38,7 @@ def _init():
try:
fas_conf = SingleConfigParser()
- fas_conf.read_single(['fas.conf', '/etc/autoqa/fas.conf'])
+ fas_conf.read('/etc/autoqa/fas.conf')
fas = fas_conf.get_section('fas')
user = fas['username']
pswd = fas['password']
diff --git a/lib/python/config.py b/lib/python/config.py
index 1d7bc73..29eac2c 100644
--- a/lib/python/config.py
+++ b/lib/python/config.py
@@ -102,7 +102,7 @@ def getbool(value):
autoqa_conf = SingleConfigParser()
-autoqa_conf.read_single(['autoqa.conf', '/etc/autoqa/autoqa.conf'])
+autoqa_conf.read('/etc/autoqa/autoqa.conf')
if __name__ == '__main__':
print "logdir = %s" % logdir
diff --git a/lib/python/repoinfo.py b/lib/python/repoinfo.py
index de9f2de..b397744 100644
--- a/lib/python/repoinfo.py
+++ b/lib/python/repoinfo.py
@@ -23,8 +23,7 @@ from ConfigParser import SafeConfigParser
from config import SingleConfigParser
import warnings
-configpath = ('repoinfo.conf',
- '/etc/autoqa/repoinfo.conf',)
+configpath = ('/etc/autoqa/repoinfo.conf',)
class RepoinfoConfig(object):
def __init__(self, arch="$basearch", filelist=configpath, defaults={}):
--
1.7.3.5
13 years, 2 months
[AutoQA] #261: Add rsync and scp dependencies to autotest
by fedora-badges
#261: Add rsync and scp dependencies to autotest
----------------------+-----------------------------------------------------
Reporter: kparal | Owner: jlaska
Type: task | Status: new
Priority: major | Milestone: 0.4.4
Component: autotest | Keywords:
----------------------+-----------------------------------------------------
Autotest (client) package should have following additional dependencies:
{{{
rsync
openssh-client
openssh-server
}}}
They are required so that the server is able to contact the client.
On the other hand, autotest-server does not really require openssh-server
(but it will inherit it from autotest package). Is it a problem?
--
Ticket URL: <https://fedorahosted.org/autoqa/ticket/261>
AutoQA <http://autoqa.fedorahosted.org>
Automated QA project
13 years, 2 months
[PATCH] Create lib/autotest//site_autotest.py to handle test client preparation
by James Laska
This replaces the method previously used in lib/autotest/site_packages.py. To
avoid non-standard file permissions for tests in
/usr/share/autotest/client/site_tests, this patch creates site_autotest.py to
perform additional steps when preparing an autotest client for jobs. In
site_autotest.py, we extend the existing BaseAutotest._install() method to
perform several tasks prior to the standard autotest client preparation. Those
tasks include:
* Optionally install additional yum repositories (based on optional global_config.ini option)
* Install, or upgrade, autoqa
* Copy all files in /etc/autoqa to the client
This patch also updates autoqa.spec and Makefile to include the new file.
---
Makefile | 3 +-
autoqa.spec | 3 +-
lib/autotest/site_autotest.py | 42 +++++++++++++++++++++++++++++++++++++++++
lib/autotest/site_packages.py | 34 ---------------------------------
4 files changed, 46 insertions(+), 36 deletions(-)
create mode 100644 lib/autotest/site_autotest.py
delete mode 100644 lib/autotest/site_packages.py
diff --git a/Makefile b/Makefile
index f8d65ad..4a2134a 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,8 @@ install: build
for t in tests/*; do cp -a $$t $(PREFIX)$(TEST_DIR); done
install -d $(PREFIX)$(AUTOTEST_DIR)/client/{bin,common_lib}
install -m 0644 lib/autotest/site_utils.py $(PREFIX)$(AUTOTEST_DIR)/client/bin/
- install -m 0644 lib/autotest/site_packages.py $(PREFIX)$(AUTOTEST_DIR)/client/common_lib/
+ install -d $(PREFIX)$(AUTOTEST_DIR)/server
+ install -m 0644 lib/autotest/site_autotest.py $(PREFIX)$(AUTOTEST_DIR)/server/
( cd lib/python; $(PYTHON) setup.py install --skip-build --root $(PREFIX)/ )
build: lib/python/build
diff --git a/autoqa.spec b/autoqa.spec
index a2189bd..b8112b6 100644
--- a/autoqa.spec
+++ b/autoqa.spec
@@ -15,6 +15,7 @@ Requires: autotest
Requires: koji
Requires: python-fedora
Requires: mod_wsgi
+BuildRequires: autotest
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
@@ -59,7 +60,7 @@ rm -rf $RPM_BUILD_ROOT
%{testdir}
%{hookdir}
%{_datadir}/autotest/client/bin/site_utils.py*
-%{_datadir}/autotest/client/common_lib/site_packages.py*
+%{_datadir}/autotest/server/site_autotest.py*
%{python_sitelib}/autoqa*
diff --git a/lib/autotest/site_autotest.py b/lib/autotest/site_autotest.py
new file mode 100644
index 0000000..04bbd2c
--- /dev/null
+++ b/lib/autotest/site_autotest.py
@@ -0,0 +1,42 @@
+# site_autotest.py - site-specific autotest extensions for use in autoqa
+#
+# this must be copied to autotest/server/, because it is imported by
+# autotest/server/server.py
+#
+# Author: James Laska <jlaska(a)redhat.com>
+
+import os
+import logging
+import common
+from autotest_lib.server.autotest import BaseAutotest
+from autotest_lib.client.common_lib import global_config
+
+class SiteAutotest(BaseAutotest):
+ def _install(self, host=None, autodir=None, use_autoserv=True,
+ use_packaging=True):
+
+ # First, enable any requested yum repositories
+ logging.info("Installing autoqa on %s", host.hostname)
+ c = global_config.global_config
+ repository_cfg_urls = c.get_config_value(
+ "FEDORA.AUTOQA", "repository_cfg_urls", type=list, default=list())
+
+ for url in repository_cfg_urls:
+ logging.debug("Enabling %s package repo" % os.path.basename(url))
+ host.run("cd /etc/yum.repos.d && (test -f %s || curl -s -O %s)" % \
+ (os.path.basename(url), url))
+
+ # Next, ensure autoqa is installed and up-to-date
+ logging.debug("Installing or upgrading autoqa package")
+ host.run("yum -y install autoqa")
+
+ # Next, copy any autoqa config files
+ logging.debug("Copying autoqa configuration files")
+ host.send_file('/etc/autoqa', '/etc/autoqa', delete_dest=True)
+
+ result = host.run("rpm -q autoqa")
+ logging.info("Installation of %s completed" % result.stdout)
+
+ # Finally, continue installation by calling our parent
+ super(SiteAutotest, self)._install(host, autodir, use_autoserv, use_packaging)
+
diff --git a/lib/autotest/site_packages.py b/lib/autotest/site_packages.py
deleted file mode 100644
index 280e064..0000000
--- a/lib/autotest/site_packages.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# site_packages.py - site-specific autotest packages methods for use in autoqa
-#
-# this must be copied to autotest/client/common_lib, because it is imported by
-# autotest/client/common_lib/packages.py
-#
-# Author: Kamil Paral <kparal(a)redhat.com>
-
-import os, glob, shutil
-from autotest_lib.client.common_lib import base_packages
-
-class SitePackageManager(base_packages.BasePackageManager):
- def tar_package(self, pkg_name, src_dir, dest_dir, exclude_string=None):
- '''
- Same as common_lib.base_packages.tar_package, but it also copies all
- AutoQA config files into src_dir for our site_tests.
- '''
- autoqa_test = (os.path.basename(os.path.dirname(src_dir)) == 'site_tests')
- configs = glob.glob('/etc/autoqa/*')
-
- # if this is our test, copy all config files to src_dir to be tarred
- # and transferred to client
- if autoqa_test:
- for config in configs:
- shutil.copy(config, src_dir)
-
- # run the parent method
- result = super(SitePackageManager, self).tar_package(pkg_name, src_dir, dest_dir, exclude_string)
-
- # remove all the config files
- if autoqa_test:
- for config in configs:
- os.remove(os.path.join(src_dir, os.path.basename(config)))
-
- return result
--
1.7.3.4
13 years, 2 months
[AutoQA] #256: CWD override does not work
by fedora-badges
#256: CWD override does not work
----------------------+-----------------------------------------------------
Reporter: kparal | Owner:
Type: defect | Status: new
Priority: critical | Milestone: 0.4.4
Component: core | Keywords:
----------------------+-----------------------------------------------------
We recently pushed patch to read config files from CWD by default
(5d37e59128c1913946c02e6a1d899a5576f37801). Then we pushed patch to
initialize autoqa_conf variable in config.py, used e.g. by koji_utils.py.
And that broke it. Because if you import such a module before running
run_once() method (like rpmguard does), the CWD is not yet set, and the
local autoqa.conf is not found.
The current workaround is to always have up-to-date
/etc/autoqa/autoqa.conf on autotest clients (the same approach as always
in the past).
Our current "change CWD" approach is now therefore useless. We have to
find another way to copy and access config files. The best way would be to
hack autotest to copy them directly to /etc (do we don't have to fight
with CWD at all).
Ouch ouch.
--
Ticket URL: <https://fedorahosted.org/autoqa/ticket/256>
AutoQA <http://autoqa.fedorahosted.org>
Automated QA project
13 years, 2 months
[PATCH] copy config files to clients in a better way
by Kamil Paral
From: James Laska <jlaska(a)redhat.com>
This replaces the method previously used in lib/autotest/site_packages.py.
To avoid non-standard file permissions for tests in
/usr/share/autotest/client/site_tests, this patch creates site_autotest.py
to perform additional steps when preparing an autotest client for jobs.
In site_autotest.py, we extend the existing BaseAutotest._install() method
to copy /etc/autoqa directory to the client. In future we can also use
this approach to copy additional files.
This patch also updates autoqa.spec and Makefile to include the new
file.
---
Makefile | 3 ++-
autoqa.spec | 2 +-
lib/autotest/site_autotest.py | 28 ++++++++++++++++++++++++++++
lib/autotest/site_packages.py | 34 ----------------------------------
4 files changed, 31 insertions(+), 36 deletions(-)
create mode 100644 lib/autotest/site_autotest.py
delete mode 100644 lib/autotest/site_packages.py
diff --git a/Makefile b/Makefile
index f8d65ad..4a2134a 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,8 @@ install: build
for t in tests/*; do cp -a $$t $(PREFIX)$(TEST_DIR); done
install -d $(PREFIX)$(AUTOTEST_DIR)/client/{bin,common_lib}
install -m 0644 lib/autotest/site_utils.py $(PREFIX)$(AUTOTEST_DIR)/client/bin/
- install -m 0644 lib/autotest/site_packages.py $(PREFIX)$(AUTOTEST_DIR)/client/common_lib/
+ install -d $(PREFIX)$(AUTOTEST_DIR)/server
+ install -m 0644 lib/autotest/site_autotest.py $(PREFIX)$(AUTOTEST_DIR)/server/
( cd lib/python; $(PYTHON) setup.py install --skip-build --root $(PREFIX)/ )
build: lib/python/build
diff --git a/autoqa.spec b/autoqa.spec
index a2189bd..4d93d52 100644
--- a/autoqa.spec
+++ b/autoqa.spec
@@ -59,7 +59,7 @@ rm -rf $RPM_BUILD_ROOT
%{testdir}
%{hookdir}
%{_datadir}/autotest/client/bin/site_utils.py*
-%{_datadir}/autotest/client/common_lib/site_packages.py*
+%{_datadir}/autotest/server/site_autotest.py*
%{python_sitelib}/autoqa*
diff --git a/lib/autotest/site_autotest.py b/lib/autotest/site_autotest.py
new file mode 100644
index 0000000..adfbc2d
--- /dev/null
+++ b/lib/autotest/site_autotest.py
@@ -0,0 +1,28 @@
+# site_autotest.py - site-specific autotest extensions for use in autoqa
+#
+# this must be copied to autotest/server/, because it is imported by
+# autotest/server/server.py
+#
+# Author: James Laska <jlaska(a)redhat.com>
+
+import logging
+from autotest_lib.server.autotest import BaseAutotest
+
+class SiteAutotest(BaseAutotest):
+ def _install(self, host=None, autodir=None, use_autoserv=True,
+ use_packaging=True):
+
+ # NOTE: Due to inconsistent rsync/scp behavior inside autotest, all
+ # the transferred directories must end with a slash and must be removed
+ # and re-created at the destination machine prior to the transfer
+
+ # copy autoqa config files
+ logging.debug("Copying autoqa configuration files")
+ srcdir = '/etc/autoqa/'
+ destdir = srcdir
+ host.run('rm -rf %(dir)s; mkdir -p %(dir)s' % {'dir': destdir})
+ host.send_file(srcdir, destdir)
+
+ # Finally, continue installation by calling our parent
+ super(SiteAutotest, self)._install(host, autodir, use_autoserv, use_packaging)
+
diff --git a/lib/autotest/site_packages.py b/lib/autotest/site_packages.py
deleted file mode 100644
index 280e064..0000000
--- a/lib/autotest/site_packages.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# site_packages.py - site-specific autotest packages methods for use in autoqa
-#
-# this must be copied to autotest/client/common_lib, because it is imported by
-# autotest/client/common_lib/packages.py
-#
-# Author: Kamil Paral <kparal(a)redhat.com>
-
-import os, glob, shutil
-from autotest_lib.client.common_lib import base_packages
-
-class SitePackageManager(base_packages.BasePackageManager):
- def tar_package(self, pkg_name, src_dir, dest_dir, exclude_string=None):
- '''
- Same as common_lib.base_packages.tar_package, but it also copies all
- AutoQA config files into src_dir for our site_tests.
- '''
- autoqa_test = (os.path.basename(os.path.dirname(src_dir)) == 'site_tests')
- configs = glob.glob('/etc/autoqa/*')
-
- # if this is our test, copy all config files to src_dir to be tarred
- # and transferred to client
- if autoqa_test:
- for config in configs:
- shutil.copy(config, src_dir)
-
- # run the parent method
- result = super(SitePackageManager, self).tar_package(pkg_name, src_dir, dest_dir, exclude_string)
-
- # remove all the config files
- if autoqa_test:
- for config in configs:
- os.remove(os.path.join(src_dir, os.path.basename(config)))
-
- return result
--
1.7.3.5
13 years, 2 months
[PATCH] add BuildRequire: autotest
by Kamil Paral
From: James Laska <jlaska(a)redhat.com>
This adds build dependency on autotest, because we need to set autotest
group on fas.conf.
---
autoqa.spec | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/autoqa.spec b/autoqa.spec
index a2189bd..3a94546 100644
--- a/autoqa.spec
+++ b/autoqa.spec
@@ -15,6 +15,7 @@ Requires: autotest
Requires: koji
Requires: python-fedora
Requires: mod_wsgi
+BuildRequires: autotest
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
--
1.7.3.5
13 years, 2 months
[AutoQA] #259: lib/autotest/site_utils.py does not apply
by fedora-badges
#259: lib/autotest/site_utils.py does not apply
----------------------+-----------------------------------------------------
Reporter: kparal | Owner:
Type: defect | Status: new
Priority: minor | Milestone: 0.5.0
Component: autotest | Keywords:
----------------------+-----------------------------------------------------
We have lib/autotest/site_utils.py that overrides send_email() method and
allows to specify a custom mailserver. However, it seems that it does not
work. The problem is, that we install the autotest client into
/usr/share/autotest/client (the file goes to
/usr/share/autotest/client/bin/site_utils.py). But when autotest is auto-
installed on the autotest client (which happens before every test
execution), it is installed into /usr/share/autotest (directly there, not
to the client/ subdir).
Therefore it seems that our override has no effect. We have to either find
a way to install it into a correct directory on the client, or we must
push the change to upstream. I requested the change in this ticket:
http://autotest.kernel.org/ticket/44
--
Ticket URL: <https://fedorahosted.org/autoqa/ticket/259>
AutoQA <http://autoqa.fedorahosted.org>
Automated QA project
13 years, 2 months