[openstack-dev] [oslo][all] Make CONF.set_override with paramter enforce_type=True by default may break unit test

ChangBo Guo glongwave at gmail.com
Mon Apr 3 16:01:42 UTC 2017


Hi ALL,

oslo_config provides method CONF.set_override[1] , developers usually use
it to change config option's value in tests. That's convenient . By
default  parameter enforce_type=False,  it doesn't check any type or value
of override. If set enforce_type=True , will check parameter override's
type and value.  In production code(running time code),  oslo_config
always checks  config option's value. In short, we test and run code in
different ways. so there's  gap:  config option with wrong type or invalid
value can pass tests when
parameter enforce_type = False in consuming projects.  that means some
invalid or wrong tests are in our code base.


We began to warn user about the change since Sep, 2016 in [2]. This change
will notify consuming project to write correct test cases with config
options.
We would make enforce_type = true by default in [3], that may break some
projects' tests, that's also raise wrong unit tests. The failure is easy to
fix, which
is recommended.


[1]
https://github.com/openstack/oslo.config/blob/efb287a94645b15b634e8c344352696ff85c219f/oslo_config/cfg.py#L2613
[2] https://review.openstack.org/#/c/365476/
[3] https://review.openstack.org/328692

-- 
ChangBo Guo(gcb)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170404/37a16670/attachment.html>


More information about the OpenStack-dev mailing list