yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #63157
[Bug 1517839] Re: Make CONF.set_override with parameter enforce_type=True by default
You missed Tempest. Excerpt from RDO trunk logs (which uses the master branch of oslo.config, not the released version like - iirc - tox):
https://trunk.rdoproject.org/centos7-master-head/64/55/6455980e71abd2300f3ef15400593f479122de83_f98deee5/rpmbuild.log
DEBUG: FAIL: tempest.tests.test_config.TestServiceClientConfig.test_service_client_config_no_service
DEBUG: tags: worker-7
DEBUG: ----------------------------------------------------------------------
DEBUG: Empty attachments:
DEBUG: stderr
DEBUG: stdout
DEBUG: Traceback (most recent call last):
DEBUG: File "tempest/tests/test_config.py", line 32, in setUp
DEBUG: self.useFixture(fake_config.ServiceClientsConfigFixture())
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 679, in useFixture
DEBUG: reraise(*exc_info)
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 666, in useFixture
DEBUG: fixture.setUp()
DEBUG: File "tempest/tests/fake_config.py", line 97, in setUp
DEBUG: self.conf.set_default('v3_endpoint_type', 'fake_v3_uri', 'identity')
DEBUG: File "/usr/lib/python2.7/site-packages/debtcollector/removals.py", line 261, in wrapper
DEBUG: return f(*args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2312, in __inner
DEBUG: result = f(self, *args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2659, in set_default
DEBUG: opt_info['opt'], default, enforce_type)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2665, in _get_enforced_type_value
DEBUG: converted = self._convert_value(value, opt)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2943, in _convert_value
DEBUG: return opt.type(value)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/types.py", line 156, in __call__
DEBUG: repr(value)))
DEBUG: ValueError: Valid values are [public, admin, internal, publicURL, adminURL, internalURL], but found 'fake_v3_uri'
DEBUG: ======================================================================
DEBUG: FAIL: tempest.tests.test_config.TestServiceClientConfig.test_service_client_config_service_all
DEBUG: tags: worker-7
DEBUG: ----------------------------------------------------------------------
DEBUG: Empty attachments:
DEBUG: stderr
DEBUG: stdout
DEBUG: Traceback (most recent call last):
DEBUG: File "tempest/tests/test_config.py", line 32, in setUp
DEBUG: self.useFixture(fake_config.ServiceClientsConfigFixture())
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 679, in useFixture
DEBUG: reraise(*exc_info)
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 666, in useFixture
DEBUG: fixture.setUp()
DEBUG: File "tempest/tests/fake_config.py", line 97, in setUp
DEBUG: self.conf.set_default('v3_endpoint_type', 'fake_v3_uri', 'identity')
DEBUG: File "/usr/lib/python2.7/site-packages/debtcollector/removals.py", line 261, in wrapper
DEBUG: return f(*args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2312, in __inner
DEBUG: result = f(self, *args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2659, in set_default
DEBUG: opt_info['opt'], default, enforce_type)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2665, in _get_enforced_type_value
DEBUG: converted = self._convert_value(value, opt)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2943, in _convert_value
DEBUG: return opt.type(value)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/types.py", line 156, in __call__
DEBUG: repr(value)))
DEBUG: ValueError: Valid values are [public, admin, internal, publicURL, adminURL, internalURL], but found 'fake_v3_uri'
DEBUG: ======================================================================
DEBUG: FAIL: tempest.tests.test_config.TestServiceClientConfig.test_service_client_config_service_minimal
DEBUG: tags: worker-7
DEBUG: ----------------------------------------------------------------------
DEBUG: Empty attachments:
DEBUG: stderr
DEBUG: stdout
DEBUG: Traceback (most recent call last):
DEBUG: File "tempest/tests/test_config.py", line 32, in setUp
DEBUG: self.useFixture(fake_config.ServiceClientsConfigFixture())
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 679, in useFixture
DEBUG: reraise(*exc_info)
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 666, in useFixture
DEBUG: fixture.setUp()
DEBUG: File "tempest/tests/fake_config.py", line 97, in setUp
DEBUG: self.conf.set_default('v3_endpoint_type', 'fake_v3_uri', 'identity')
DEBUG: File "/usr/lib/python2.7/site-packages/debtcollector/removals.py", line 261, in wrapper
DEBUG: return f(*args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2312, in __inner
DEBUG: result = f(self, *args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2659, in set_default
DEBUG: opt_info['opt'], default, enforce_type)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2665, in _get_enforced_type_value
DEBUG: converted = self._convert_value(value, opt)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2943, in _convert_value
DEBUG: return opt.type(value)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/types.py", line 156, in __call__
DEBUG: repr(value)))
DEBUG: ValueError: Valid values are [public, admin, internal, publicURL, adminURL, internalURL], but found 'fake_v3_uri'
DEBUG: ======================================================================
DEBUG: FAIL: tempest.tests.test_config.TestServiceClientConfig.test_service_client_config_service_unknown
DEBUG: tags: worker-7
DEBUG: ----------------------------------------------------------------------
DEBUG: Empty attachments:
DEBUG: stderr
DEBUG: stdout
DEBUG: Traceback (most recent call last):
DEBUG: File "tempest/tests/test_config.py", line 32, in setUp
DEBUG: self.useFixture(fake_config.ServiceClientsConfigFixture())
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 679, in useFixture
DEBUG: reraise(*exc_info)
DEBUG: File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 666, in useFixture
DEBUG: fixture.setUp()
DEBUG: File "tempest/tests/fake_config.py", line 97, in setUp
DEBUG: self.conf.set_default('v3_endpoint_type', 'fake_v3_uri', 'identity')
DEBUG: File "/usr/lib/python2.7/site-packages/debtcollector/removals.py", line 261, in wrapper
DEBUG: return f(*args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2312, in __inner
DEBUG: result = f(self, *args, **kwargs)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2659, in set_default
DEBUG: opt_info['opt'], default, enforce_type)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2665, in _get_enforced_type_value
DEBUG: converted = self._convert_value(value, opt)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2943, in _convert_value
DEBUG: return opt.type(value)
DEBUG: File "/usr/lib/python2.7/site-packages/oslo_config/types.py", line 156, in __call__
DEBUG: repr(value)))
DEBUG: ValueError: Valid values are [public, admin, internal, publicURL, adminURL, internalURL], but found 'fake_v3_uri'
** Also affects: tempest
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1517839
Title:
Make CONF.set_override with parameter enforce_type=True by default
Status in Cinder:
In Progress
Status in cloudkitty:
Fix Released
Status in Designate:
Fix Released
Status in Freezer:
In Progress
Status in Glance:
Invalid
Status in heat:
Fix Released
Status in Ironic:
Triaged
Status in Karbor:
Fix Released
Status in OpenStack Identity (keystone):
Fix Released
Status in kolla:
Confirmed
Status in Magnum:
In Progress
Status in Manila:
Fix Released
Status in Murano:
Fix Released
Status in neutron:
Won't Fix
Status in OpenStack Compute (nova):
Fix Released
Status in octavia:
New
Status in oslo.config:
Fix Released
Status in oslo.messaging:
Fix Released
Status in Quark: Money Reinvented:
New
Status in Rally:
Fix Released
Status in senlin:
Fix Released
Status in tacker:
In Progress
Status in tempest:
Confirmed
Status in watcher:
Fix Released
Bug description:
1. Problems :
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.
[1]
https://github.com/openstack/oslo.config/blob/master/oslo_config/cfg.py#L2173
2. Proposal
1) Fix violations when enforce_type=True in each project.
2) Make method CONF.set_override with enforce_type=True by default
in oslo_config
You can find more details and comments in
https://etherpad.openstack.org/p/enforce_type_true_by_default
3. How to find violations in your projects.
1. Run tox -e py27
2. then modify oslo.config with enforce_type=True
cd .tox/py27/lib64/python2.7/site-packages/oslo_config
edit cfg.py with enforce_type=True
- def set_override(self, name, override, group=None, enforce_type=False):
+ def set_override(self, name, override, group=None, enforce_type=True):
3. Run tox -e py27 again, you will find violations.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1517839/+subscriptions