fix: remove attachment-specific checks from cmdStatus to match CNI spec#171
Merged
Conversation
scotwells
previously approved these changes
Jun 30, 2026
privateip
added a commit
that referenced
this pull request
Jun 30, 2026
The 'multiple annotations returns first' test expected a specific container ID from findContainerID(), but the function iterates over a Go map which has non-deterministic ordering. This caused the CI Unit Tests job to fail intermittently with: gc_test.go:82: findContainerID() = "ccc333ddd444", want "aaa111bbb222" Update the test to accept either of the two possible container IDs. Fixes CI failure in PR #171. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
privateip
added a commit
that referenced
this pull request
Jun 30, 2026
The 'multiple annotations returns first' test expected a specific container ID from findContainerID(), but the function iterates over a Go map which has non-deterministic ordering. This caused the CI Unit Tests job to fail intermittently with: gc_test.go:82: findContainerID() = "ccc333ddd444", want "aaa111bbb222" Update the test to accept either of the two possible container IDs. Fixes CI failure in PR #171.
4d414c0 to
8bd1688
Compare
scotwells
previously approved these changes
Jun 30, 2026
scotwells
left a comment
Contributor
There was a problem hiding this comment.
Got merge conflicts on this one
cmdStatus was checking VRF and host interface existence, but the CNI spec defines STATUS as answering "is this plugin ready to service ADD requests?" — not "does a prior ADD's state persist?". On a freshly started node before any ADD has run, no VRF or host interface exists, so cmdStatus always failed. Remove the VRF and host-interface checks. STATUS now only verifies: 1. Config is parseable (parseConf) 2. API server is reachable (probeAPIServer) fixes #164
The 'multiple annotations returns first' test expected a specific container ID from findContainerID(), but the function iterates over a Go map which has non-deterministic ordering. This caused the CI Unit Tests job to fail intermittently with: gc_test.go:82: findContainerID() = "ccc333ddd444", want "aaa111bbb222" Update the test to accept either of the two possible container IDs. Fixes CI failure in PR #171.
8bd1688 to
9bfac2d
Compare
The cmdStatus STATUS operation must succeed on a freshly started node before any ADD has run, but the existing tests and implementation had three bugs: probeAPIServer tests mocked the wrong variable, parseConf rejected configs missing VPC/VPCAttachment, and a static fmt.Errorf triggered a lint warning. - Fix probeAPIServer tests to mock probeAPIServer instead of probeAPIServerFn, which is the variable actually called by cmdStatus - Add parseStatusConf that validates only cniVersion, type, and interface_type (if present), skipping VPC/VPCAttachment since STATUS must succeed before any ADD has ever run - Replace fmt.Errorf with errors.New for a static error string in a test to satisfy the perfsprint lint rule
scotwells
approved these changes
Jun 30, 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.
cmdStatus was checking VRF and host interface existence, but the CNI spec defines STATUS as answering "is this plugin ready to service ADD requests?" — not "does a prior ADD's state persist?". On a freshly started node before any ADD has run, no VRF or host interface exists, so cmdStatus always failed.
Remove the VRF and host-interface checks. STATUS now only verifies:
fixes #164