Skip to content

fix: use CheckLevel.UNSET for an unset level in testing.CheckInfo - #2878

Merged
tonyandrewmeyer merged 4 commits into
canonical:mainfrom
tonyandrewmeyer:fix/scenario-check-info-level-unset
Nov 13, 2026
Merged

tonyandrewmeyer merged 4 commits into
canonical:mainfrom
tonyandrewmeyer:fix/scenario-check-info-level-unset

Conversation

@tonyandrewmeyer

@tonyandrewmeyer tonyandrewmeyer commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

In Scenario, a CheckInfo with no level gave the charm None, where real Pebble gives CheckLevel.UNSET, so a charm comparing against CheckLevel.UNSET behaved differently in its tests than in production.

Behaviour change

testing.CheckInfo.level is now CheckLevel.UNSET rather than None when no level is given, in both the input and output state. Passing level=None still works, but a test asserting check_info.level is None will fail.

A hyrum run on #2854, which included this change, found no new failures.

Real Pebble gives CheckLevel.UNSET for a check with no level, but in Scenario a charm saw None, so a charm comparing against CheckLevel.UNSET behaved differently in its tests than in production. None is still accepted, and means the same as not passing a level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tonyandrewmeyer and others added 2 commits November 12, 2026 11:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every check info in the mock comes from CheckInfo._to_ops(), whose level
is now always a CheckLevel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MattPatchava MattPatchava left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, LGTM

…/scenario-check-info-level-unset

# Conflicts:
#	ops/pebble.py
@tonyandrewmeyer
tonyandrewmeyer merged commit 2ade198 into canonical:main Nov 13, 2026
60 checks passed
@tonyandrewmeyer
tonyandrewmeyer deleted the fix/scenario-check-info-level-unset branch November 13, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants