I've been working on merging logans tables into the Server of Beaker. I
haven't pushed my changes up but I will soon. Thought I'd share a
little of how things are going.
With everything being in one database it makes the cross linking very
powerful. I imported two tests from existing rhts (no modifications)
and then did a few queries on the Distros I have imported.
The two tests are the generic /distribution/install test and the
/distribution/virt/start test. The install test (hmm.. maybe I should
rename tests to tasks now as DMalcolm suggested) should run for every
distro. The virt/start test only runs on i386,x86_64 and ia64.
So if we query a distro that happens to be s390x and ask it to give us a
list of tests that that distro can use. We only get the install test.
>> print Distro.query()[1].arch, Distro.query()[1].tests().all()
s390x [Test(repo=None, name=u'/distribution/install',
license=u'GPL',
update_date=datetime.datetime(2009, 6, 18, 14, 2, 25, 454665), nda=None,
description=u'Reports back on the Installation that was done',
owner_id=None, creation_date=datetime.datetime(2009, 6, 18, 14, 2, 25,
79307), version=u'1.8-46', valid=None, avg_time=1200,
path=u'/mnt/tests/distribution/install', destructive=None,
rpm=u'rh-tests-distribution-install-1.8-46.noarch.rpm', id=1)]
Here we have an x86_64 distro and it gets both tests.
>> print Distro.query()[2].arch, Distro.query()[2].tests().all()
x86_64 [Test(repo=None, name=u'/distribution/install',
license=u'GPL',
update_date=datetime.datetime(2009, 6, 18, 14, 2, 25, 454665), nda=None,
description=u'Reports back on the Installation that was done',
owner_id=None, creation_date=datetime.datetime(2009, 6, 18, 14, 2, 25,
79307), version=u'1.8-46', valid=None, avg_time=1200,
path=u'/mnt/tests/distribution/install', destructive=None,
rpm=u'rh-tests-distribution-install-1.8-46.noarch.rpm', id=1),
Test(repo=None, name=u'/distribution/virt/start', license=u'GPLv2',
update_date=datetime.datetime(2009, 6, 18, 14, 11, 17, 735755),
nda=None, description=u'Start virtual machines', owner_id=None,
creation_date=datetime.datetime(2009, 6, 18, 14, 11, 17, 611317),
version=u'2.0-14', valid=None, avg_time=7200,
path=u'/mnt/tests/distribution/virt/start', destructive=None,
rpm=u'rh-tests-distribution-virt-start-2.0-14.noarch.rpm', id=2)]
No rocket science involved here. Just a much nicer system than the old
one. :-) And tests can be excluded not just on arch and family like the
old system, we can exclude tests on minor updates now as well.
Distros().tests looks like this:
def tests(self):
"""
List of tests that support this distro
"""
tests = session.query(Test)
return tests.filter(
not_(or_(Test.id.in_(select([test_table.c.id]).
where(test_table.c.id==test_exclude_table.c.test_id).
where(test_exclude_table.c.arch_id==arch_table.c.id).
where(arch_table.c.id==self.arch_id)
),
Test.id.in_(select([test_table.c.id]).
where(test_table.c.id==test_exclude_table.c.test_id).
where(test_exclude_table.c.osmajor_id==osmajor_table.c.id).
where(osmajor_table.c.id==self.osversion.osmajor.id)
),
Test.id.in_(select([test_table.c.id]).
where(test_table.c.id==test_exclude_table.c.test_id).
where(test_exclude_table.c.osversion_id==osversion_table.c.id).
where(osversion_table.c.id==self.osversion.id)
),
)
)
)
I also imported an xml job which looked like this before I imported:
<job>
<workflow>generic_xml_workflow</workflow>
<submitter>bpeck(a)redhat.com</submitter>
<whiteboard>Test abort recipe</whiteboard>
<recipeSet>
<recipe testrepo='development' whiteboard='kernel'>
<distroRequires>
<distro_arch op='=' value='i386'/>
<distro_name op='=' value='RHEL5.3-Server-20090106.0'/>
</distroRequires>
<hostRequires>
<memory op='>=' value='1024'/>
</hostRequires>
<test role='STANDALONE' name='/distribution/install'/>
<test role='STANDALONE' name='/distribution/kernelinstall'>
<params>
<param name='KERNELARGNAME' value='kernel'/>
<param name='KERNELARGVARIANT' value='up'/>
<param name='KERNELARGVERSION'
value='2.6.18-153.el5testabort'/>
</params>
</test>
</recipe>
</recipeSet>
</job>
then after importing the system sees it this way.
>> recipe=Recipe.query()[3]
>> print recipe.to_xml().toprettyxml()
<recipe arch="i386"
distro="RHEL5.3-Server-20090106.0"
family="RedHatEnterpriseLinuxServer5" id="4" job_id="3"
recipe_set_id="3" status="Queued" variant="None">
<distroRequires>
<distro_arch op="=" value="i386"/>
<distro_name op="=" value="RHEL5.3-Server-20090106.0"/>
</distroRequires>
<hostRequires>
<memory op=">=" value="1024"/>
<system_type value="Machine"/>
</hostRequires>
<test avg_time="1200" id="3"
name="/distribution/install"
result="None" role="STANDALONE" status="Queued">
<rpm name="rh-tests-distribution-install-1.8-46.noarch.rpm"/>
</test>
<test avg_time="7200" id="4"
name="/distribution/kernelinstall"
result="None" role="STANDALONE" status="Queued">
<params>
<param name="KERNELARGNAME" value="kernel"/>
<param name="KERNELARGVARIANT" value="up"/>
<param name="KERNELARGVERSION"
value="2.6.18-153.el5testabort"/>
</params>
<rpm
name="rh-tests-distribution-kernelinstall-1.0-57.noarch.rpm"/>
</test>
</recipe>
The scheduler processed the distroRequires tag and filled that info in
the recipe attributes. I don't have it processing the hostRequires
yet. But very shortly. Notice the test records have additional
information filled in as well like avg_time (again, I should take this
opportunity and change that to max_time, /me makes a note).
The good thing is you will always be able to take an existing job and
re-feed it back into the system and the import will only pay attention
to the needed fields. We could have an option to not reprocess the
hostRequires and distroRequires if you really want the same run.