fix: use juju.wait for workload version tests in k8s tutorial#2650
Merged
tromai merged 7 commits intoJul 20, 2026
Merged
Conversation
dwilding
approved these changes
Jul 17, 2026
tromai
marked this pull request as ready for review
July 19, 2026 22:13
…chapter-3-onwards
dwilding
approved these changes
Jul 20, 2026
james-garner-canonical
approved these changes
Jul 20, 2026
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.
Fixes #2646
This PR fixes the
test_workload_version_setintegration tests in the Example Charms inexample/k8-*The bug
From Chapter 3 onward,
test_deploywaits for the charm to block, which happens immediately on the first config-changed event, as there is no database yet. This is before Pebble is ready. Then the tests move on totest_workload_version_is_set, which fails because Pebble is still not ready.You can see it in the CI run https://github.com/canonical/operator/actions/runs/29348881449/job/87139670139#step:9:79
Why this happened.
In #2638, I changed the order of
test_workload_version_is_setto beforetest_database_integration. Previously, it ran aftertest_database_integration, so everything was okay.The fix
We wanted to make
test_workload_version_is_setindependent fromtest_database_integration. This is okay because the workload version depends on Pebble readiness, and not the database integration.Therefore, I use
juju.waituntil the workload version is available from juju status. This fits nicely into how we use Jubilant in charm integration tests.I validated this on my fork
test_workload_version_is_setpassed in CI run for Example Charm Integration Tests: https://github.com/tromai/operator/actions/runs/29554228387I also validated that the CI still pass whether
test_workload_version_is_setis before or aftertest_database_integration.