[Openstack] fake_flags + common breakout

Russell Bryant rbryant at redhat.com
Fri May 4 16:23:13 UTC 2012


On 05/04/2012 12:16 PM, Eric Windisch wrote:
> I added a flag in my branch which uses a flag defined in the ZeroMQ driver.
> 
> This was fine before, but is a problem now, because tests/__init__.py
> doesn't do rpc.register_opts. Instead, it does
> FLAGS.register_opts(rpc.rpc_opts), which only loads the common RPC flags.
> 
> Of course, the flags file *defines* the RPC driver to be used, so there
> would be no benefit of running rpc.register_opts until after fake_flags
> is loaded.
> 
> The easiest solutions I see are:
> A. load fake_flags.py, then rpc.register_opts, then run a fake_rpc_flags.py.
> B. import rpc, add rpc.register_opts to fake_flags.py, then add any
> flags we want.
> C. not support testing flags on RPC drivers, have a common "testing" flag.

I guess another question is, why do you need to set ZeroMQ related flags
in fake_flags?  I think those should only be settings that apply for
*all* unit tests.  I would just register your flags in your unit tests.

https://github.com/openstack/nova/blob/master/nova/tests/rpc/test_qpid.py#L69

It's kind of a hack, but hopefully we can kill this whole
register_opts() thing eventually anyway, as I mentioned in another message.

-- 
Russell Bryant




More information about the Openstack mailing list