From ffb00d01b74476df1e659d9511e5505fbe5fb279 Mon Sep 17 00:00:00 2001 From: Juan Manuel Parrilla Madrid Date: Fri, 24 Jul 2026 18:07:13 +0200 Subject: [PATCH] fix(nodepool): fix data race in TestEnqueueNodePoolsForCloudConfig DeepCopy shared test objects before passing them to the fake client builder. Parallel subtests were sharing the same HostedControlPlane and NodePool pointers, and fake.NewClientBuilder().WithObjects() mutates ResourceVersion on the objects causing a data race. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Juan Manuel Parrilla Madrid --- .../controllers/nodepool/nodepool_controller_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hypershift-operator/controllers/nodepool/nodepool_controller_test.go b/hypershift-operator/controllers/nodepool/nodepool_controller_test.go index b16323ab6ef2..544753f03512 100644 --- a/hypershift-operator/controllers/nodepool/nodepool_controller_test.go +++ b/hypershift-operator/controllers/nodepool/nodepool_controller_test.go @@ -3864,7 +3864,11 @@ func TestEnqueueNodePoolsForCloudConfig(t *testing.T) { t.Parallel() g := NewWithT(t) - c := fake.NewClientBuilder().WithScheme(api.Scheme).WithObjects(tc.objects...).Build() + objs := make([]client.Object, len(tc.objects)) + for i, o := range tc.objects { + objs[i] = o.DeepCopyObject().(client.Object) + } + c := fake.NewClientBuilder().WithScheme(api.Scheme).WithObjects(objs...).Build() r := &NodePoolReconciler{Client: c} result := r.enqueueNodePoolsForCloudConfig(context.Background(), tc.cm)