[openstack-dev] [qa] changes to interacting with Tempest config

Sean Dague sean at dague.net
Mon Dec 23 10:55:00 UTC 2013


One of the longer standing issues we've had in Tempest was the Tempest
is a set of tests without it's own UI (we just us tox to call testr),
and *need* a config file. The provides some interesting chicken and egg
issues about when we get the config file. There is a long set of
evolution here, but this kept causing issues as we refactored to cleaner
ways to integrate with testr.

As of Friday we're taking a different approach, which will hopefully
make everything much simpler. We've implemented a proxy class in front
our oslo config object which lazy evaluates the config file the first
time someone asks for an attribute. This lets us get the parsing
entirely out of the class hierarchy of the tests.

For tempest developers and reviewers, here are the things you should be
looking for.

1) No one should call TempestConfig() themselves any more.

The correct way to get the tempest config is:

from tempest import config

CONF = config.CONF

.... inside some class ...
    if CONF.service_available.neutron:

CONF is actually callable a lot more places now because of the
evaluation order, which means we're going to be able to move a lot more
of the skip logic into decorators. Yay!

2) Classes should stop having self.config or cls.config

Because of the way setupClass was working, there was a ton of setting
self.config / cls.config in class setup. We should stop that. The
cleanups here are good low hanging fruit for new contributors.

I'm sure there are optimizations to make our proxy object pattern better
-
https://github.com/openstack/tempest/blob/master/tempest/config.py#L738
comments welcomed there. However it has at least decoupled config from
class hierarchy now, so will be easier to work on the problems
separately instead of coupled.

	-Sean

-- 
Sean Dague
Samsung Research America
sean at dague.net / sean.dague at samsung.com
http://dague.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131223/7c851fc7/attachment.pgp>


More information about the OpenStack-dev mailing list