Skip to content

docs: fix unit tests of Kubernetes tutorial charms, so that override: merge isn't expected - #2951

Open
dwilding wants to merge 1 commit into
canonical:mainfrom
dwilding:fix-k8s-example-unit-tests
Open

dwilding wants to merge 1 commit into
canonical:mainfrom
dwilding:fix-k8s-example-unit-tests

Conversation

@dwilding

Copy link
Copy Markdown
Contributor

#2872 fixed a modelling error in Scenario. When combining layers, override would previously take on the overriding layer's value. After that PR (and today's release), override takes on the first layer's value.

So we need to remove a line from the unit tests of the k8s-2 and onwards charms. We can also streamline the K8s tutorial by removing the explanation of why the k8s-1 unit test needed modifying in k8s-2.

@chapman-von-monty

Copy link
Copy Markdown

Code review — canonical/operator PR #2951

Reviewed revision: 5c460f1ba81b1ae6e17e7f7326020d2b8aa9d7ed
Base: ac3acefeafb9d8a4eff7cc1734e8b255ed4eba92
Scope: Full first review of the saved PR diff, five files (four Kubernetes tutorial example unit tests and one tutorial page). Review is pinned to REVIEW_SNAPSHOT.json; no moving PR ref was used.

1. Verdict — APPROVE

No blocking or non-blocking issues found. The four test edits remove a test-only mutation of the expected Pebble plan, not an assertion; the full plan comparison remains. Per the post-#2872 layer-combination behavior, the base/first layer's override value is retained, so constructing the expected plan from ROCK_LAYER without changing its service override is consistent with the charm's merged plan. The documentation removes the now-obsolete instruction and rationale and transitions directly to the configurable-port test.

2. Blocking Issues (Must Fix)

None.

3. Non-Blocking Suggestions & Nitpicks

None.

4. Downstream & Ecosystem Considerations

No downstream compatibility or ecosystem risks identified. The patch changes neither charm runtime behavior nor framework APIs; it updates tutorial test expectations and explanatory documentation to reflect Scenario's corrected layer-combination semantics.

Validation evidence and limits

  • Reviewed the saved full diff (PR.diff): it contains only the four deleted expected-plan assignments and the removal of their associated tutorial instruction and explanation. No unrelated changes were identified.
  • In each example, the remaining test_pebble_layer plan equality check is at examples/k8s-2-configurable/tests/unit/test_charm.py:61–65, examples/k8s-3-postgresql/tests/unit/test_charm.py:61–65, examples/k8s-4-action/tests/unit/test_charm.py:61–65, and examples/k8s-5-observe/tests/unit/test_charm.py:61–65. The expected plan is still created from ROCK_LAYER; the charm's override: merge comes from the later layer. The pinned-history review of fix: keep the check level when a merged layer does not set one #2872 establishes that Scenario's merge preserves the first layer's override value. Other tests, including the configurable-port test, remain in place.
  • The tutorial edit is in docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/make-your-charm-configurable.md:191–200 (diff context); it removes only the obsolete expected-plan editing step and leads into the retained test_config_changed example. No dangling references were found in the reviewed Kubernetes tutorial pages.
  • git diff --check on the pinned PR range succeeded.
  • The k8s-2 unit-test command was attempted in a credential-free environment, but dependency setup could not resolve https://pypi.org/simple/codespell/ because DNS/network resolution failed. The other three example suites were not run for the same dependency limitation. The docs build was not run because required tooling/dependencies were unavailable and dependency resolution failed. Therefore, no test-suite or docs-build success is claimed.

This branch has not been deployed

No deployments
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.

2 participants