-
Notifications
You must be signed in to change notification settings - Fork 1.1k
cc_modules: set default meta frequency value when no config available #1457
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
Merged
blackboxsw
merged 4 commits into
canonical:main
from
blackboxsw:fix-frequency-from-meta
May 16, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8b95c7c
cc_modules: set default meta frequency value when no config available
blackboxsw 034ad7a
tests: supplemental integration test for module frequency validation
blackboxsw cb95346
tests: no logs with None frequency
blackboxsw a0a1f0e
tests: override frequency tests modules/test_frequency_override.py
blackboxsw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/integration_tests/modules/test_frequency_override.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import pytest | ||
|
|
||
| from tests.integration_tests.instances import IntegrationInstance | ||
|
|
||
| USER_DATA = """\ | ||
| #cloud-config | ||
| runcmd: | ||
| - echo "hi" >> /var/tmp/hi | ||
| """ | ||
|
|
||
|
|
||
| @pytest.mark.user_data(USER_DATA) | ||
| def test_frequency_override(client: IntegrationInstance): | ||
| # Some pre-checks | ||
| assert ( | ||
| "running config-scripts-user with frequency once-per-instance" | ||
| in client.read_from_file("/var/log/cloud-init.log") | ||
| ) | ||
| assert client.read_from_file("/var/tmp/hi").strip().count("hi") == 1 | ||
|
|
||
| # Change frequency of scripts-user to always | ||
| config = client.read_from_file("/etc/cloud/cloud.cfg") | ||
| new_config = config.replace("- scripts-user", "- [ scripts-user, always ]") | ||
| client.write_to_file("/etc/cloud/cloud.cfg", new_config) | ||
|
|
||
| client.restart() | ||
|
|
||
| # Ensure the script was run again | ||
| assert ( | ||
| "running config-scripts-user with frequency always" | ||
| in client.read_from_file("/var/log/cloud-init.log") | ||
| ) | ||
| assert client.read_from_file("/var/tmp/hi").strip().count("hi") == 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.