Method CONF.set_override to change config option's
value with designated value in unit test, but never check if the
designated vaule is valid. Each config option has a type like StrOpt,
BoolOpt, etc. StrOpt with parameter choices only allows values in set
of choices. In short, each config option has limitation for type
and value. In production code, oslo.conf can ensure user's input is
valid, but in unit test, test methods can pass if we use method
CONF.set_override without parameter enforce_type=True even we pass wrong
type or wrong value to config option. This commit makes sure calling
method CONF.set_override with enforce_type=True and fixes violations.
Note: We can't set enforce_type=True by default in oslo.config now, it
may break all project's unit test. We can switch enforce_type=True by
default when all project fix violations like this commit.
Related-Bug: #1517839
Reviewed: https:/ /review. openstack. org/266345 /git.openstack. org/cgit/ openstack/ murano/ commit/ ?id=e0c1653fa83 c0e3b232fd217aa ee6124b9089779
Committed: https:/
Submitter: Jenkins
Branch: master
commit e0c1653fa83c0e3 b232fd217aaee61 24b9089779
Author: LiuNanke <email address hidden>
Date: Tue Jan 12 20:45:28 2016 +0800
make enforce_type=True in CONF.set_override
Method CONF.set_override to change config option's set_override without parameter enforce_type=True even we pass wrong
value with designated value in unit test, but never check if the
designated vaule is valid. Each config option has a type like StrOpt,
BoolOpt, etc. StrOpt with parameter choices only allows values in set
of choices. In short, each config option has limitation for type
and value. In production code, oslo.conf can ensure user's input is
valid, but in unit test, test methods can pass if we use method
CONF.
type or wrong value to config option. This commit makes sure calling
method CONF.set_override with enforce_type=True and fixes violations.
Note: We can't set enforce_type=True by default in oslo.config now, it
may break all project's unit test. We can switch enforce_type=True by
default when all project fix violations like this commit.
Related-Bug: #1517839
Change-Id: Ia9f6b8a04290f9 3699fc1f613ce0e 841f040d4ae