----- "Will Woods" <wwoods(a)redhat.com> wrote:
> So. I think the sensible thing to do might be to have a new file
> where
> we can store/override test metadata - things like labels and hooks.
> Yes,
> this means another file for each test (boo! more files!) but if we're
> smart about the file format/syntax we won't need to add any others. I
> hope.
Ok, you bought me in. I have meditated over all the possible stuff we
could use the new file for and this is came out of my fantasies:
control.autoqa:
=============================================
# This file can expect some variables pre-defined:
# hook: name of the hook to run this test
# archs: list of host archs to run this test on
# execute: whether to execute this test at all, by default True
# all test arguments (envr, name, kojitag, etc)
# 1. Metadata definitions
# a) Autotest labels needed for this test to run
labels = ['virt']
labels.append(envr.split('.')[-1]) # distro part of envr (like 'fc13')
# b) Host architectures override
# Some tests may need to override the default set of pre-selected
# host architectures. That is logical, because the watcher can't know
# all the specifics of a certain test, so the architecture selection
# may not be optimal. For example some tests need to be executed only
# once on an arbitrary architecture, even though the packages are built
# for several architectures. Rpmlint as an example of such a test.
# These tests can override the default selection here.
archs = ['noarch'] # this is rpmlint, we will test all archs at once,
# no need to run it on several hosts
# 2. Decision whether to run this test at all
# This is a place where a test may decide whether it should be run
# under specified conditions, or just skipped. There might be many
# reasons why to skip this test:
# - it doesn't make sense to execute this test under current hook
# - the test doesn't support current combination of specified
# arguments
# - combination of the above (it doesn't make sense to run this test
# under this hook with these arguments)
# If you don't want to run this test, just set 'execute' to False
# a) Hook decision
supported_hooks = ['post-koji-build', 'post-bodhi-build']
if hook not in supported_hooks:
execute = False
# b) Arguments decision
# this is an initscripts test, we support only a few packages where
# initscripts should be tested. it doesn't make sense to run this
# test for all other packages. therefore if we don't have a testfile
# for this package in our tests/ subdirectory, just skip this test
if name not in os.listdir('tests'):
# not supported
execute = False
============================================= (EOF)
<implementation>
In the autoqa harness we would just evaluate such control.autoqa file
for every test available and then look at some output variables
(execute, archs, labels) and schedule jobs accordingly. The watchers
would no longer pass testlist option to autoqa, that would be resolved
inside autoqa script.
</implementation>
It's good to mention:
* That was just an example file. Real files may be much simpler or
much more complicated.
* I have tried to come up with all the important stuff we might need,
but it's certain we will discover further metadata/decision items
in the future.
And some questions:
1. Are we able to do all this with just a template/config file?
Personally the security risk of scripting language seems negligible
to me and defining this stuff with config files seems overcomplicated
to me (and some parts would have to be left out completely).
2. This new file seems to solve several of our issues at once, I think
it's quite neat (self-applause! booo!) :) But is also seems like a
major architecture overhaul. Do we want to do it right now?
I'll gladly volunteer, but first we must decide - do we want to
concentrate purely on depcheck/other PUATP stuff right now and just
add a quick dirty labels support (with plans of doing it properly
in the future), or is this worth doing properly right now?
>
> Ah, true. But if you're iterating over the keys of a dict, you can
> do:
> for key in vars.keys():
> rather than copying the entire dict.
Err, I thought it returns an iterator, but it returns a standard
list. One is still learning, isn't he? :) Patched, thanks.