Repository navigation
test(e2e): cover registry retag guard and tag update rollback - #881
Conversation
Reviewer's GuideThe PR expands the Docker Compose E2E harness with an opt-in registry manifest retag race and a failing tag-update rollback scenario, using dedicated image fixtures, compose files, wrapper behavior, cleanup, and assertions for runtime, configuration, queue, incident, and audit state. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/e2e-docker-compose.sh" line_range="762" />
<code_context>
+
+ run compose down -v --remove-orphans
+ write_tag_rollback_compose_file
+ compose_before="$(cat "$COMPOSE_FILE")"
+ run compose up -d
+ wait_for_container_version old
</code_context>
<issue_to_address>
**Trailing newline rollback goes undetected**
When rollback changes only the Compose file’s trailing newline bytes, the `$(cat ...)` captures for `compose_before` and `COMPOSE_FILE` strip trailing newlines, so the equality assertion passes and the test reports a successful restoration despite different file bytes.
Save the original Compose file as a byte-preserving snapshot and compare it with the restored file using a bytewise comparison such as `cmp`.
Also at `tests/e2e-docker-compose.sh:798-799`.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/e2e-docker-compose.sh:762
a69ab41 to
aef927e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@coderabbitai review |
✅ Action performedReview finished.
|
aef927e to
ba786eb
Compare
|



Summary
The Docker E2E suite only covered successful updates and a preflight failure. It never proved, against real Docker, that recreation ignores a moved registry tag (#643), or that a failed tag update rolls back. This PR adds both scenarios to
tests/e2e-docker-compose.sh.pull_policy: always. A new opt-in hook in the e2e Docker wrapper moves the registry'slatesttag to a third image right after the updater'scompose pulland before recreation. It does this with a registry-side manifest copy, so local tags are untouched. The test asserts the hook fired, the container runs the pullednewimage, the local tag still points at that image, and the run is recorded assuccess. The scenario then restoreslatestfor later scenarios.1.0→2.0with--allow-tag-updates, where2.0fails its healthcheck. The test asserts exit 1, the WUD line is kept, the compose file is byte-identical to the original, the old container is healthy again, and the incident log reportsrollback=restored-and-healthyandmanual_review_required=no. It also checks the audit status isfailure.E2E_RETAG_AFTER_COMPOSE_PULLis set, so the existing scenarios are unaffected. New local tags are added to cleanup.Reviewers: a plain same-tag update that fails its health check records
health-failedand does not roll back. Only compose-rewrite paths (tag updates, digest pins) restore. That's why the rollback scenario uses a tag update.Scope
--pull neverbut not--no-build, so test(compose): extend real-Docker coverage for recreation options #644 stays open for that and any other fix(compose): prevent image replacement during recreation #643 options.Checklist
README.mdordocs/updated if install, deployment, config, or user-facing behavior changed — N/A: test-onlydocs/examples/template.envordocs/examples/webui.env.exampleupdated if environment variables or example config changed — N/ACHANGELOG.mdedit needed outside release prepTest plan
tests/run-all.sh— N/A: test-only change to the Docker-gated harness; ran the harness directly insteadFocused test(s):
bash -n tests/e2e-docker-compose.shandshellcheck tests/e2e-docker-compose.sh— passed--pull neverremoved fromComposeCli.up(), the retag scenario failed withapp container did not reach version new; the change was revertedDocker or Compose validation, if container behavior changed:
tests/e2e-docker-compose.shpassed locally on Docker 29.4 / Compose v5.1.2 with all six scenarios. On macOS,TMPDIRmust point at a non-symlinked directory: the default/var/folderstemp path resolves to/private/var/folders, which makes the existing stack-recreate scenario fail locally because of a path mismatch. That failure is unrelated to this change and doesn't occur on Linux CI.