-
Notifications
You must be signed in to change notification settings - Fork 138
Add test for foremanctl --pulp-log-level #22316
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -460,3 +460,52 @@ def test_positive_foremanctl_log_level(module_target_sat): | |
| 'foreman_proxy_log_level still present in parameters after reset' | ||
| ) | ||
| assert 'log_level' not in params, 'log_level still present in parameters after reset' | ||
|
|
||
|
|
||
| @pytest.mark.foremanctl | ||
| def test_positive_foremanctl_pulp_log_level(module_target_sat): | ||
| """Verify foremanctl deploy --pulp-log-level persists and applies to Pulp services. | ||
|
|
||
| :id: de48bbb5-7a0f-48fd-a984-98b26dad45e1 | ||
|
|
||
| :steps: | ||
| 1. Deploy with --pulp-log-level=error | ||
| 2. Verify pulp_log_level is persisted in parameters file | ||
| 3. Verify PULP_LOG_LEVEL=error is applied on pulp-api | ||
| 4. Trigger Pulp activity and verify DEBUG is absent from pulp-api journal | ||
|
|
||
| :expectedresults: | ||
| 1. pulp_log_level=error is persisted correctly | ||
| 2. pulp-api environment has PULP_LOG_LEVEL=error | ||
| 3. pulp-api journal has no DEBUG messages after activity | ||
| """ | ||
| sat = module_target_sat | ||
|
|
||
| result = sat.execute( | ||
| 'foremanctl deploy --pulp-log-level=error', | ||
| timeout='30m', | ||
| ) | ||
| assert result.status == 0, f'foremanctl deploy --pulp-log-level=error failed:\n{result.stderr}' | ||
|
|
||
| params = sat.load_remote_yaml_file(FOREMANCTL_PARAMETERS_FILE) | ||
| assert params.pulp_log_level == 'error', ( | ||
| f'pulp_log_level not persisted correctly: {params.get("pulp_log_level")}' | ||
| ) | ||
|
|
||
| result = sat.execute( | ||
| "podman inspect pulp-api --format '{{range .Config.Env}}{{println .}}{{end}}' " | ||
| "| grep '^PULP_LOG_LEVEL='" | ||
| ) | ||
| assert result.status == 0, f'Failed to read PULP_LOG_LEVEL from pulp-api:\n{result.stderr}' | ||
| assert 'PULP_LOG_LEVEL=error' in result.stdout, ( | ||
| f'Expected PULP_LOG_LEVEL=error, got:\n{result.stdout}' | ||
| ) | ||
|
|
||
| # With level=error, DEBUG must not appear (ERROR lines are not guaranteed on happy path) | ||
| sat.execute('hammer ping') | ||
| result = sat.execute( | ||
| r'journalctl --no-pager -u pulp-api.service --since "-2 min" | grep -i ":DEBUG:"' | ||
| ) | ||
| assert result.status != 0, ( | ||
|
Comment on lines
+505
to
+509
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (testing): Reliance on This check depends on Suggested implementation: # With level=error, DEBUG must not appear (ERROR lines are not guaranteed on happy path)
sat.execute('hammer ping')
journal = sat.execute(
'journalctl --no-pager -u pulp-api.service --since "-5 min"'
)
assert journal.status == 0, (
f'Failed to read pulp-api.service journal when pulp_log_level=error:\n{journal.stderr}'
)
assert 'debug' not in journal.stdout.lower(), (
'DEBUG messages found in pulp-api.service journal when pulp_log_level=error'
)
assert 'log_level' not in params, 'log_level still present in parameters after reset'
|
||
| 'DEBUG messages found in pulp-api.service journal when pulp_log_level=error' | ||
| ) | ||
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.
suggestion (testing): Test does not validate
foremanctl deploy --helpoutput for--pulp-log-leveloptions as described in the PRThe test currently covers deploy behavior and configuration only. Please add assertions that
foremanctl deploy --helpexits successfully and that its help text includes the--pulp-log-leveloption and all expected log level choices (debug,info,warning,error,critical), so the CLI interface is also validated as described in the PR.