test/e2e: wait for ClusterGroup readiness before probing connectivity - #8202
Open
Archong-Liu wants to merge 1 commit into
Open
test/e2e: wait for ClusterGroup readiness before probing connectivity#8202Archong-Liu wants to merge 1 commit into
Archong-Liu wants to merge 1 commit into
Conversation
Archong-Liu
force-pushed
the
fix/clustergroup-e2e-wait
branch
from
July 20, 2026 17:16
1717f9d to
b6a0a62
Compare
…tivity waitForResourceReady had a no-op case for ClusterGroup and Group, so a test step creating an ACNP/ANNP and the group it references only waited for the policy's own realized status, not for the group's membership to actually be computed. On the agent side, a rule is realizable as soon as the referenced AddressGroup object exists in the local cache, not once its membership matches the cluster's current state. So the controller can push an early, incomplete AddressGroup snapshot, the agent installs the rule and reports Realized, and a connectivity probe right after can race ahead of the group's actual resolved membership. This is what caused the flaky ACNPClusterGroupUpdate failure in antrea-io#8180's CI run, described in antrea-io#8201. Add a wait on GroupMembersComputed for both ClusterGroup and Group, mirroring how ACNP/ANNP already wait on Phase == Realized. Unlike ACNP/ANNP, a timeout here needs explicit per-step handling: two existing test cases, testACNPNestedClusterGroupCreateAndUpdate and testANNPNestedGroupCreateAndUpdate, intentionally reference a childGroup that isn't created until a later step, so GroupMembersComputed is correctly never true during that step. testACNPNestedIPBlockClusterGroupCreateAndUpdate is unaffected since it always creates all childGroups within the same step as their parent. Add AllowPartialGroupRealization on TestStep, defaulting to false (a timeout is a failure, with a clear error message), and set it only on the specific steps that reference a not-yet-existing child. Every other test keeps the strict wait, so a real regression in group realization still fails loudly instead of silently passing. Verified locally against a Kind cluster with NodeNetworkPolicy=true: ACNPClusterGroupUpdate (the original flake), the nested ClusterGroup and Group tests, and the plain Group tests (ANNPGroupUpdate, ANNPGroupAppliedToPodAdd, ANNPGroupServiceRefDelete, TestAntreaPolicyStatusWithAppliedToUnsupportedGroup) all pass. Signed-off-by: ArchongLiu <aaarrchong@gmail.com>
Archong-Liu
force-pushed
the
fix/clustergroup-e2e-wait
branch
from
July 20, 2026 17:35
b6a0a62 to
cb74ccb
Compare
Archong-Liu
marked this pull request as ready for review
July 23, 2026 14:57
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.
Fixes the flaky
ACNPClusterGroupUpdatee2e failure described in #8201.waitForResourceReadyhad a no-op case forClusterGroupandGroup, so a test step creating an ACNP/ANNP and the group it references only waited for the policy's own realized status, never for the group's membership to actually be computed. On the agent side, a rule is realizable as soon as the referenced AddressGroup object exists in the local cache, not once its membership matches the cluster's current state, so the controller can push an early, incomplete snapshot, the agent installs the rule and reports Realized, and a connectivity probe right after can race ahead of the group's actual resolved membership.This adds a wait on
GroupMembersComputedfor bothClusterGroupandGroup, mirroring how ACNP/ANNP already wait onPhase == Realized. Two existing test cases,testACNPNestedClusterGroupCreateAndUpdateandtestANNPNestedGroupCreateAndUpdate, intentionally reference a childGroup that isn't created until a later step, soGroupMembersComputedis correctly never true for those specific steps. To keep the wait strict everywhere else,TestStepgets a newAllowPartialGroupRealizationfield (defaultfalse); only those two steps set it totrue. Every other test, including severalGroupcases that previously had no wait at all, now fails loudly with a clear error if group realization genuinely regresses, instead of silently passing or racing.This went through a couple of narrower revisions first (ClusterGroup only, then a timeout-is-not-a-failure workaround) before landing on the version above; see #8201 for how that played out.
Test plan
Built agent/controller images from this branch and ran on a local Kind cluster with
NodeNetworkPolicy=true. All of the following pass:TestAntreaNodeNetworkPolicy/Case=ACNPClusterGroupUpdate(the original flake)TestAntreaPolicy/TestGroupNoK8sNPcasesACNPNestedClusterGroup,ACNPNestedIPBlockClusterGroup,ACNPClusterGroupServiceRef,ANNPNestedGroup,ANNPGroupUpdate,ANNPGroupAppliedToPodAdd,ANNPGroupServiceRefDeleteTestAntreaPolicyStatusWithAppliedToUnsupportedGroup