Commit Graph

4 Commits

Author SHA1 Message Date
ChangBo Guo(gcb) f0a2e9791a Adjust test with option 'backend'
Config option 'backend' with parameter choices =['noop', 'statsd'],
that means oslo.config will ensure value is one of them, otherwise
a ValueError will be raised, so don't need handle and test config
option 'backend' with invalid value.

Change-Id: Ibda809416c565d57f19179d7f13f4cee8f8145ff
2017-06-16 11:26:02 +08:00
John L. Villalovos 61a0c2582b Prevent tests from using utils.execute()
This change introduces a new base test class that mocks out
utils.execute() and similar functions and forces an exception if it
gets called. If utils.execute() is mocked by the test case then it
will work. What this does is prevent un-mocked access to
utils.execute() / processutils.execute() and similar subprocess
library functions.

Inspired by Julian Edwards' patch to ironic-python-agent

Change-Id: Ie5bda8f4c65cf4dfb40b91c11b61485c954addde
2017-05-17 09:21:26 -07:00
Javier Pena 87c196d670 Use enforce_type=False in test_nonexisting_backend
Config option metrics/backend only accepts values "noop" or "statsd" [1],
however test_nonexisting_backend() checks for a different value.
oslo.config 4.0 will check overridden value type by default[2], so we
need to set enforce_type in CONF.set_override to allow unit tests to
pass.

[1] 36109e58f2/ironic_lib/metrics_utils.py (L25-L28)
[2] https://review.openstack.org/#/c/328692/

Change-Id: Ia597da0d03cfcc5f34b271a12cc42600c6a6a2d3
2017-04-18 13:34:48 +02:00
Aline Bousquet fb46000e24 Add support for metrics
This patch adds metrics to ironic-lib, so that it can be used by both
Ironic and IPA. It implements a generic MetricLogger including timers,
counters, and gauges with their respective decorators and context
managers. Two default MetricLogger are included: NoopMetricLogger and
StatsdMetricLogger.

Change-Id: I8a62414e6c03acb6f3457f1b8f81c03a9d3a8576
Co-Authored-By: Josh Gachnang <josh@pcsforeducation.com>
Co-Authored-By: Jim Rollenhagen <jim@jimrollenhagen.com>
Co-Authored-By: Alex Weeks <alex.weeks@gmail.com>
Partial-Bug: #1526219
2016-06-28 13:38:01 +01:00