Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion kepler/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ unit = [
]
# Dependencies of integration tests
integration = [
"jubilant>=1.8,<2",
"jubilant==1.12.0",
"pytest",
"pytest-jubilant>=2.0.1,<3",
"PyYAML",
Expand All @@ -58,6 +58,10 @@ show_missing = true
[tool.pytest.ini_options]
minversion = "6.0"
log_cli_level = "INFO"
# Retain INFO logs in the "Captured log call" section when run interactively.
# Otherwise, that section will have DEBUG logs (coming from log_file_level).
log_level = "INFO"
log_file_level = "DEBUG"

# Linting tools configuration
[tool.ruff]
Expand Down
13 changes: 13 additions & 0 deletions kepler/tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ def test_deploy(charm: pathlib.Path, juju: jubilant.Juju):
}
juju.deploy(charm, app=APP_NAME, resources=resources)
juju.wait(jubilant.all_active)


def test_log_level_filters_debug_from_captured_logs(
juju: jubilant.Juju,
caplog: pytest.LogCaptureFixture,
):
"""With log_level=INFO, captured logs retain INFO but filter out DEBUG."""
juju.wait(jubilant.all_active)
wait_records = [r for r in caplog.records if r.name == "jubilant.wait"]
# Jubilant 1.12.0 logs app/unit status changes at INFO on the first poll.
assert any(r.levelno == logging.INFO for r in wait_records)
# The verbose gron diff is logged at DEBUG; log_level=INFO filters it out.
assert not any(r.levelno == logging.DEBUG for r in wait_records)
70 changes: 35 additions & 35 deletions kepler/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion kosmos/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ unit = [
]
# Dependencies of integration tests
integration = [
"jubilant>=1.8,<2",
"jubilant==1.12.0",
"pytest",
"pytest-jubilant>=2.0.1,<3",
"PyYAML",
Expand All @@ -58,6 +58,9 @@ show_missing = true
[tool.pytest.ini_options]
minversion = "6.0"
log_cli_level = "INFO"
# Without log_level set, the "Captured log call" section gets DEBUG logs coming
# from log_file_level (the file handler lowers the root logger to DEBUG).
log_file_level = "DEBUG"

# Linting tools configuration
[tool.ruff]
Expand Down
14 changes: 14 additions & 0 deletions kosmos/tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ def test_deploy(charm: pathlib.Path, juju: jubilant.Juju):
}
juju.deploy(charm, app=APP_NAME, resources=resources)
juju.wait(jubilant.all_active)


@pytest.mark.xfail(strict=True, reason="without log_level=INFO, DEBUG logs are captured")
def test_log_level_filters_debug_from_captured_logs(
juju: jubilant.Juju,
caplog: pytest.LogCaptureFixture,
):
"""With log_level=INFO, captured logs retain INFO but filter out DEBUG."""
juju.wait(jubilant.all_active)
wait_records = [r for r in caplog.records if r.name == "jubilant.wait"]
# Jubilant 1.12.0 logs app/unit status changes at INFO on the first poll.
assert any(r.levelno == logging.INFO for r in wait_records)
# The verbose gron diff is logged at DEBUG; log_level=INFO filters it out.
assert not any(r.levelno == logging.DEBUG for r in wait_records)
70 changes: 35 additions & 35 deletions kosmos/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading