-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add option to provide collectors for hardware dependent tests #168
feat: Add option to provide collectors for hardware dependent tests #168
Conversation
3fd8293
to
0689dfd
Compare
3ff2a28
to
9e6391f
Compare
2f17a32
to
be3eba9
Compare
06fca3c
to
c6711ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
Also adds "realhw" marker which when applied to test functions, will skip them in case no collectors are provided via the CLI option.
These tests were added: * collector was enabled in hardware-exporter-config.yaml file * metrics are available at the expected endpoint on the unit * collector specific metrics are also available at the endpoint based on the collectors options provided. Also added helper functions and a dataclass for obtaining metrics data and parsing it.
* Move helper functions from SyncHelper to utils.py * Obtain default exporter port constant from config.py * Refactor parse_metrics to simplify logic * Change test_config_collector_enabled so that it passes only when all enabled collectors for the hardware are provided
c6711ca
to
0557fab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most LGTM, some non-blocking comments
This PR is part of the effort to automate many of the manual tests for hardware observer. These tests depend on the availability of actual hardware resources. The tests are not meant to be run as part of CI but provide an easier way to validate functionality with real hardware whenever required, for example, before a new release.
The tests include:
Collectors that need to be tested (as per availability on the underlying hardware) can be provided via the
--collectors
flag as space separated arguments. Eg:--collectors ipmi_sel redfish mega_raid
. These collectors need to belong to a pre-configured list present inconftest.py
.The
realhw
marker has also been added to mark the tests which are hardware dependent. If the--collectors
flag is not provided, then all these tests will be skipped so that only the regular, hardware independent tests are executed.A
Metric
dataclass has been created to hold the metric data to facilitate testing. The accompanying parsing functions help to convert the raw string of metrics into this structure. Currently,test_collector_specific_metrics_available
utilizes this to check whether the metrics for the provided collectors are present in the metrics output. In future, this can be used to test for specific value and labels for the metrics.A new
utils.py
module has been added to collect all the helper functions (including the ones from theSyncHelper
class which have been moved here).Currently, running these hardware dependent tests require adding the machine to the model beforehand and performing the deployments manually for
hardware-observer
,grafana-agent
andubuntu
applications. The modifications to thetest_build_and_deploy
function for automating this via the bundle and adding the required juju resources will be handled in another PR.