Skip to content

Commit 89898f8

Browse files
committed
UPSTREAM: <138159>: Tests: Call removeNodeTaint variadically instead of in a loop
I believe there is a sneaky timing/caching issue here. When RemoveTaintsOffNode removes taints one at a time in a loop, each iteration reads the node from the API server cache, removes one taint, and patches. If the cache is stale for any iteration (still reflecting the state before the previous patch's watch event propagated) the patch sends the full stale list minus only the current taint, effectively re-adding the taint that was just removed in the prior step. Since the loop has already moved past that taint, it's never cleaned up. verifyThatTaintIsGone (previously called once per loop) doesn't catch this because it only checks whether the current taint was removed, not whether previously removed taints were re-introduced. The fix is to remove all taints in a single cycle instead of looping, which removeNodeTaint's variadic signature already supports.
1 parent 9193b12 commit 89898f8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

test/e2e/framework/node/resource.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,14 @@ func CreatePodsPerNodeForSimpleApp(ctx context.Context, c clientset.Interface, n
598598
// RemoveTaintsOffNode removes a list of taints from the given node
599599
// It is simply a helper wrapper for RemoveTaintOffNode
600600
func RemoveTaintsOffNode(ctx context.Context, c clientset.Interface, nodeName string, taints []v1.Taint) {
601+
taintPtrs := make([]*v1.Taint, len(taints))
602+
for i := range taints {
603+
taintPtrs[i] = &taints[i]
604+
}
605+
err := removeNodeTaint(ctx, c, nodeName, nil, taintPtrs...)
606+
gomega.ExpectWithOffset(1, err).NotTo(gomega.HaveOccurred())
601607
for _, taint := range taints {
602-
RemoveTaintOffNode(ctx, c, nodeName, taint)
608+
verifyThatTaintIsGone(ctx, c, nodeName, &taint)
603609
}
604610
}
605611

0 commit comments

Comments
 (0)