From e915399026e2b8b45efa48ea88b8c598288c42a2 Mon Sep 17 00:00:00 2001 From: Rohan Thakkar Date: Fri, 17 Jul 2026 12:33:03 -0700 Subject: [PATCH] Fix registry race test compilation Update the race-only test to use the current metav1.Object-based Registry API. Signed-off-by: Rohan Thakkar --- pkg/model/registry_test.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pkg/model/registry_test.go b/pkg/model/registry_test.go index e5a7a7317..15373ebbf 100644 --- a/pkg/model/registry_test.go +++ b/pkg/model/registry_test.go @@ -70,18 +70,18 @@ func Test_Registry_BasicOperations_ConcurrencyTest(t *testing.T) { go func() { startWg.Done() startWg.Wait() // Block until the other goroutine has begun execution - reg.RegisterConfigMap(testCmA) - reg.RegisterPVC(testPvcA) + reg.RegisterConfigMap(&testCmA) + reg.RegisterPVC(&testPvcA) doneWg.Done() }() go func() { startWg.Done() startWg.Wait() // Block until the other goroutine has begun execution - reg.RegisterConfigMap(testCmA) - reg.RegisterConfigMap(testCmAOtherNamespace) - reg.RegisterConfigMap(testCmB) - reg.RegisterPVC(testPvcB) + reg.RegisterConfigMap(&testCmA) + reg.RegisterConfigMap(&testCmAOtherNamespace) + reg.RegisterConfigMap(&testCmB) + reg.RegisterPVC(&testPvcB) doneWg.Done() }() @@ -101,7 +101,7 @@ func Test_Registry_BasicOperations_ConcurrencyTest(t *testing.T) { &testPvcA: PVC, &testPvcB: PVC, } { - if got := reg.hasEntity(expectedEntityType, *expectedMetaObj); !got { + if got := reg.hasEntity(expectedEntityType, expectedMetaObj); !got { t.Errorf( "Expected registry to contain entity type %s:{Namespace = %s, Name = %s}", expectedEntityType, @@ -117,20 +117,20 @@ func Test_Registry_BasicOperations_ConcurrencyTest(t *testing.T) { go func() { startWg.Done() - startWg.Wait() // Block until the other goroutine has begun execution - reg.RegisterPVC(testPvcD) // Add a net-new PVC (both goroutines) - reg.deleteEntity(ConfigMap, testCmAOtherNamespace) // Delete testCmAOtherNamespace (only this goroutine) - reg.deleteEntity(ConfigMap, testCmB) // Delete testCmB (both goroutines) + startWg.Wait() // Block until the other goroutine has begun execution + reg.RegisterPVC(&testPvcD) // Add a net-new PVC (both goroutines) + reg.deleteEntity(ConfigMap, &testCmAOtherNamespace) // Delete testCmAOtherNamespace (only this goroutine) + reg.deleteEntity(ConfigMap, &testCmB) // Delete testCmB (both goroutines) doneWg.Done() }() go func() { startWg.Done() - startWg.Wait() // Block until the other goroutine has begun execution - reg.RegisterPVC(testPvcC) // Add a net-new PVC (only this goroutine) - reg.RegisterPVC(testPvcD) // Add a net-new PVC (both goroutines) - reg.deleteEntity(ConfigMap, testCmB) // Delete testCmB (both goroutines) - reg.deleteEntity(PVC, testPvcB) // Delete testPvcB (only this goroutine) + startWg.Wait() // Block until the other goroutine has begun execution + reg.RegisterPVC(&testPvcC) // Add a net-new PVC (only this goroutine) + reg.RegisterPVC(&testPvcD) // Add a net-new PVC (both goroutines) + reg.deleteEntity(ConfigMap, &testCmB) // Delete testCmB (both goroutines) + reg.deleteEntity(PVC, &testPvcB) // Delete testPvcB (only this goroutine) doneWg.Done() }() @@ -152,7 +152,7 @@ func Test_Registry_BasicOperations_ConcurrencyTest(t *testing.T) { &testPvcC: PVC, // We added testPvcC (one of the goroutines) &testPvcD: PVC, // We added testPvcD (both goroutines tried) } { - if got := reg.hasEntity(expectedEntityType, *expectedMetaObj); !got { + if got := reg.hasEntity(expectedEntityType, expectedMetaObj); !got { t.Errorf( "Expected registry to contain entity type %s:{Namespace = %s, Name = %s}", expectedEntityType, @@ -171,7 +171,7 @@ func Test_Registry_BasicOperations_ConcurrencyTest(t *testing.T) { go func() { startWg.Done() startWg.Wait() // Block until the other goroutine has begun execution - reg.Walk(func(entityType EntityType, meta v1.ObjectMeta) { + reg.Walk(func(entityType EntityType, meta v1.Object) { threadAObjsSeen++ }) doneWg.Done() @@ -181,7 +181,7 @@ func Test_Registry_BasicOperations_ConcurrencyTest(t *testing.T) { go func() { startWg.Done() startWg.Wait() // Block until the other goroutine has begun execution - reg.Walk(func(entityType EntityType, meta v1.ObjectMeta) { + reg.Walk(func(entityType EntityType, meta v1.Object) { threadBObjsSeen++ }) doneWg.Done()