test: refactor init-extensions tests to avoid using ops.testing.Context.charm_spec #2527
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
ops.testingframework currently exposes the private_CharmSpecclass via theContext.charm_specattribute (canonical/operator#2131). Charm Tech will deprecate this attribute soon (canonical/operator#2219). Charmcraft currently usescharm_specin theinit-extensionstests, so this PR preemptively modernises the test to useState.from_context, avoiding the need to accessContext.charm_spec.The
init-extensionstests run only in the Ubuntu 22.04 spread tests. While that job is currently failing, the failing tests do not appear to be theinit-extensionstests:AFAICT the init-extensions tests pass, here's some relevant output from this run.
make lint && make test.I've added or updated any relevant documentation.(N/A)I've updated the relevant release notes.(N/A)