[ci]: Make pure package validation deterministic#719
Merged
Conversation
Propagate failures from looped pure.mk targets, replace privileged nsenter tests with a deterministic command seam, and keep file tests portable across TMPDIR settings. The previous workflow could skip command behavior or return the status of a later successful shell command, producing false-green validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves determinism and failure propagation in the “pure package” CI flow, while making unit tests for pkg/exec and gNOI file handling more reliable across environments (no privileged nsenter requirements and less dependence on process-level TMPDIR).
Changes:
- Make
pure.mklooped targets fail fast by enablingset -eand avoiding error-masking patterns. - Refactor
pkg/exectests to validateRunHostCommand*behavior via an in-test helper process, without requiring realnsenter. - Update gNOI file transfer tests to use a temp “host root” mapping and validate results via the physical on-disk path.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pure.mk | Ensures looped validation targets fail deterministically and clean up coverage conversion artifacts reliably. |
| pkg/gnoi/file/file_test.go | Makes file transfer tests use a host-root-mapped temp path so file assertions don’t depend on process TMPDIR. |
| pkg/exec/command.go | Adds an injectable command-construction hook to enable deterministic tests of nsenter execution paths. |
| pkg/exec/command_test.go | Replaces privileged/skip-based nsenter testing with a helper-process approach that validates stdout/stderr/exit behavior deterministically. |
Derive the pure package set from internal, pkg, and cmd so new canonical packages cannot be omitted. Run each package exactly once and align the JUnit compiler flags with the gomonkey-based tests now included. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
6 tasks
donghaolicd
approved these changes
Jul 18, 2026
16 tasks
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.
Why I did it
Pure-package validation could report false-green results:
pkg/execbehavior tests skipped when privilegednsenterwas unavailablepure.mktargets could return success after an earlier command failedTMPDIRwas under the production path allowlistHow I did it
pkg/exectests run deterministically without namespace privilegesinternal/,pkg/, andcmd/How to verify it
make -f pure.mk cimake -f pure.mk junit-xmlmake -f pure.mk list-packagesWhich release branch to backport (provide reason below if selected)
Description for the changelog
Make pure-package validation deterministic, complete, and failure-sensitive.
Link to config_db schema for YANG module changes
N/A
A picture of a cute animal (not mandatory but encouraged)