Skip to content

test/e2e: wait for ClusterGroup readiness before probing connectivity - #8202

Open
Archong-Liu wants to merge 1 commit into
antrea-io:mainfrom
Archong-Liu:fix/clustergroup-e2e-wait
Open

test/e2e: wait for ClusterGroup readiness before probing connectivity#8202
Archong-Liu wants to merge 1 commit into
antrea-io:mainfrom
Archong-Liu:fix/clustergroup-e2e-wait

Conversation

@Archong-Liu

@Archong-Liu Archong-Liu commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Fixes the flaky ACNPClusterGroupUpdate e2e failure described in #8201.

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, 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 GroupMembersComputed for both ClusterGroup and Group, mirroring how ACNP/ANNP already wait on Phase == Realized. 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 for those specific steps. To keep the wait strict everywhere else, TestStep gets a new AllowPartialGroupRealization field (default false); only those two steps set it to true. Every other test, including several Group cases 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/TestGroupNoK8sNP cases ACNPNestedClusterGroup, ACNPNestedIPBlockClusterGroup, ACNPClusterGroupServiceRef, ANNPNestedGroup, ANNPGroupUpdate, ANNPGroupAppliedToPodAdd, ANNPGroupServiceRefDelete
  • TestAntreaPolicyStatusWithAppliedToUnsupportedGroup

…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
Archong-Liu force-pushed the fix/clustergroup-e2e-wait branch from b6a0a62 to cb74ccb Compare July 20, 2026 17:35
@Archong-Liu
Archong-Liu marked this pull request as ready for review July 23, 2026 14:57
Copilot AI review requested due to automatic review settings July 23, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants