Conversation
1 of 2 tasks
wak327
marked this pull request as draft
September 30, 2026 01:41
wak327
marked this pull request as ready for review
September 30, 2026 01:41
enable_coverage.py wraps the ExecStart=/usr line of each stage service with `coverage run`. Since the single process optimization (canonical#5489) the stage services are shims whose ExecStart is `sh -c '... | nc ...'`, so nothing got wrapped and coverage was silently no longer collected. On releases whose packaging disables the optimization, the script instead exits early because the network stage is still cloud-init.service. Wrap whichever of cloud-init-main.service and the stage services run cloud-init from /usr, and fail when none do, so that a future unit change cannot silently disable coverage again. Fixes canonicalGH-6769
wak327
force-pushed
the
test/fix-integration-coverage-single-process
branch
from
September 30, 2026 20:10
27a65dd to
301af0e
Compare
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.
Proposed Commit Message
Additional Context
Fixes #6769
The script has to handle two unit layouts:
cloud-init-main.servicerunsExecStart=/usr/bin/cloud-init --all-stages, and the stage services arencshims. The current script exits 0 without wrapping anything, so coverage is never collected.debian/patches/no-single-process.patchonubuntu/jammyandubuntu/noble): there is nocloud-init-main.service. Each stage service runs/usr/bin/cloud-init ...itself, and the network stage iscloud-init.service. The current script exits 1 becausecloud-init-network.servicedoes not exist, so the assertion ininstall_coverage()fails.I checked the new script against unit files rendered from
systemd/*.tmpland against the no-single-process variants of them. It wraps onlycloud-init-main.servicein the first case and the four stage services in the second. With no matching unit, it fails. I also confirmed that aType=notifyunit whoseExecStartis wrapped inpython -m coverage run --appendstill reaches READY and writes.coverageto its working directory (systemd-run --user --wait -p Type=notify ...). I have not run the full integration suite with coverage enabled because I don't have LXD available here.enable_profile.pyhas the same problem, and_collect_profile()intests/integration_tests/conftest.pystill expects one stats file per stage. I'm happy to fix that in a follow-up so this PR stays focused on the reported issue.Test Steps
/tmp/cloud_init_test_logs/last/html/index.htmlshould now report coverage forcloudinit/. Repeat withCLOUD_INIT_OS_IMAGE=noble CLOUD_INIT_CLOUD_INIT_SOURCE=NONEfor the no-single-process layout.Merge type