Skip to content
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

Add runtime configuration validation #9006

Merged
merged 3 commits into from May 19, 2021

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Mar 22, 2021

What does this PR do?

Adds config models from #8675

@ofek ofek requested a review from a team as a code owner March 22, 2021 17:48
@ofek ofek force-pushed the ofek/sync_config_models_win32_event_log branch from e7db523 to 33647d0 Compare March 23, 2021 14:39
@ofek ofek changed the title Sync config models Add runtime configuration validation Mar 23, 2021
@hithwen
Copy link
Contributor

hithwen commented May 17, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@hithwen
Copy link
Contributor

hithwen commented May 17, 2021

Fails on windows:

================================== FAILURES ===================================
____________________________ test_filters_not_map _____________________________
tests\test_config.py:50: in test_filters_not_map
    dd_run_check(check)
..\datadog_checks_dev\datadog_checks\dev\plugin\pytest.py:218: in run_check
    raise Exception('\n'.join(exc_lines))
E   Exception: 
E   Traceback (most recent call last):
E     File "d:\a\1\s\datadog_checks_base\datadog_checks\base\checks\base.py", line 971, in run
E       initialization()
E     File "d:\a\1\s\datadog_checks_base\datadog_checks\base\checks\base.py", line 396, in load_configuration_models
E       instance_config = self.load_configuration_model(package_path, 'InstanceConfig', raw_instance_config)
E     File "d:\a\1\s\datadog_checks_base\datadog_checks\base\checks\base.py", line 436, in load_configuration_model
E       raise_from(ConfigurationError('\n'.join(message_lines)), None)
E     File "<string>", line 3, in raise_from
E   datadog_checks.base.errors.ConfigurationError: Detected 1 error while loading configuration model `InstanceConfig`:
E   filters
E     value is not a valid dict

During handling of the above exception, another exception occurred:
tests\test_config.py:50: in test_filters_not_map
    dd_run_check(check)
E   AssertionError: Regex pattern 'The `filters` option must be a mapping.' does not match '\nTraceback (most recent call last):\n  File "d:\\a\\1\\s\\datadog_checks_base\\datadog_checks\\base\\checks\\base.py", line 971, in run\n    initialization()\n  File "d:\\a\\1\\s\\datadog_checks_base\\datadog_checks\\base\\checks\\base.py", line 396, in load_configuration_models\n    instance_config = self.load_configuration_model(package_path, \'InstanceConfig\', raw_instance_config)\n  File "d:\\a\\1\\s\\datadog_checks_base\\datadog_checks\\base\\checks\\base.py", line 436, in load_configuration_model\n    raise_from(ConfigurationError(\'\\n\'.join(message_lines)), None)\n  File "<string>", line 3, in raise_from\ndatadog_checks.base.errors.ConfigurationError: Detected 1 error while loading configuration model `InstanceConfig`:\nfilters\n  value is not a valid dict'.
============================== warnings summary ===============================

@ofek ofek force-pushed the ofek/sync_config_models_win32_event_log branch from 33647d0 to 46443fa Compare May 19, 2021 18:23
@ghost ghost added the documentation label May 19, 2021
@codecov
Copy link

codecov bot commented May 19, 2021

Codecov Report

Merging #9006 (46443fa) into master (a5389f9) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Flag Coverage Δ
win32_event_log 86.03% <100.00%> (-1.97%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...nt_log/datadog_checks/win32_event_log/constants.py 100.00% <ø> (ø)
win32_event_log/tests/test_config.py 100.00% <ø> (ø)
..._event_log/datadog_checks/win32_event_log/check.py 82.14% <100.00%> (-2.32%) ⬇️
...vent_log/datadog_checks/win32_event_log/filters.py 95.00% <100.00%> (-5.00%) ⬇️
win32_event_log/tests/test_filters.py 100.00% <100.00%> (ø)
...g_checks/win32_event_log/legacy/win32_event_log.py 69.76% <0.00%> (ø)

@ofek ofek merged commit 9367910 into master May 19, 2021
@ofek ofek deleted the ofek/sync_config_models_win32_event_log branch May 19, 2021 20:09
github-actions bot pushed a commit that referenced this pull request May 19, 2021
* Sync config models

* prove passing

* remove redundant tests 9367910
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants