verify: The issue (#42) quotes the "log-to-a-file" section of the ops integrat - #45
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Author
|
This PR is a draft. Inspect the changes, then mark it ready for review to run CI. |
pyproject.toml snippet with th
github-actions
Bot
force-pushed
the
probe/issue-42
branch
from
August 25, 2026 05:23
fe9bd4c to
18dd714
Compare
Author
|
This PR is a draft. Inspect the changes, then mark it ready for review to run CI. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The issue (#42) quotes the "log-to-a-file" section of the ops integration-testing docs, which recommends putting
log_level = "INFO"in[tool.pytest.ini_options]so that "INFO logs [are] retained in the 'Captured log call' section when run interactively." The author believeslog_level = "INFO"has no effect on Jubilant's output during an integration test.I disagree with the author. My understanding of pytest's logging is that
log_levelandlog_cli_levelare independent controls:log_cli_levelgoverns the live console output, whilelog_levelgoverns the capture handler that feeds the "Captured log call" section (and thecaplogfixture), with a default of WARNING. So even though every charm already setslog_cli_level = "INFO"(which is why Jubilant's INFO progress shows up live), withoutlog_level = "INFO"the capture handler stays at WARNING and Jubilant's INFO records are filtered out of the captured section; addinglog_level = "INFO"lowers that handler to INFO and retains them. In other words,log_level = "INFO"does affect the captured Jubilant output (just not the live output), so the doc's core claim is correct and the author's "no effect" belief is wrong — at least whenlog_cli_levelis already INFO.I tested this with a differential: I added the same integration test,
test_jubilant_info_logs_captured, to both kepler and kosmos (theirtest_charm.pyfiles were already identical, so the two versions are identical modulo the marker). The test runsjuju.wait(jubilant.all_active)for real Jubilant activity, forces thejubilantlogger to emit at INFO, emits an INFO probe record on Jubilant's logger, and asserts thatcaplogcaptured ajubilant-namespaced record at level >= INFO. The only difference between the charms is the config under test: I addedlog_level = "INFO"to kepler'spyproject.toml(so the capture handler is at INFO and the probe is retained — this test is expected to pass), and left kosmos at the default (capture handler at WARNING, so the INFO probe is filtered out — this test is marked@pytest.mark.xfail(strict=True)and is expected to fail).What the CI result means: if CI is green, kepler's test passed (INFO retained with
log_level = "INFO") and kosmos's test xfailed as expected (INFO filtered without it), which demonstrates thatlog_level = "INFO"genuinely changes whether Jubilant's INFO logs reach the captured-log section — so the doc's claim is validated and the author is refuted. If kosmos's xfail instead unexpectedly passes (xpassed understrict=True, turning CI red), that means Jubilant's INFO logs were captured even withoutlog_level = "INFO"— i.e.log_levelmade no difference here (likely becauselog_cli_level = "INFO"already drove the capture level), which would mean the author is right and the doc's recommendation is redundant in this configuration. I aimed for green because I believelog_levelindependently governs the capture handler.run_toxpasses (format, lint with pyright 0 errors, and unit) for both kepler and kosmos; the integration tests themselves only run in per-charm CI once the PR is marked ready.