@@ -20,7 +20,6 @@ import (
2020 "context"
2121 "fmt"
2222 "maps"
23- "reflect"
2423 "slices"
2524 "sync/atomic"
2625 "testing"
@@ -453,37 +452,19 @@ func verifyListAndGet(
453452 require .NoError (t , err )
454453
455454 t .Logf ("Listing %s resources in %q via %q client should return one object" , resourceName , targetCluster , cfg .Host )
456- kcptestinghelpers .Eventually (t , func () (bool , string ) {
457- list , err := dynClient .Cluster (targetCluster .Path ()).
458- Resource (wildwestv1alpha1 .SchemeGroupVersion .WithResource (resourceName )).
459- List (ctx , metav1.ListOptions {})
460- if err != nil {
461- return false , fmt .Sprintf ("failed to list: %v" , err )
462- }
463- if len (list .Items ) != 1 {
464- return false , fmt .Sprintf ("expected 1 item, got %d" , len (list .Items ))
465- }
466- actual := normalizeUnstructuredMap (list .Items [0 ].Object )
467- if ! reflect .DeepEqual (actual , expected ) {
468- return false , fmt .Sprintf ("list result mismatch:\n expected: %v\n actual: %v" , expected , actual )
469- }
470- return true , ""
471- }, wait .ForeverTestTimeout , time .Millisecond * 500 , "listing %s in %q via %q" , resourceName , targetCluster , cfg .Host )
455+ list , err := dynClient .Cluster (targetCluster .Path ()).
456+ Resource (wildwestv1alpha1 .SchemeGroupVersion .WithResource (resourceName )).
457+ List (ctx , metav1.ListOptions {})
458+ require .NoError (t , err )
459+ require .Len (t , list .Items , 1 , "Unexpected number of items in %s list in %q via %q" , resourceName , targetCluster , cfg .Host )
460+ require .Equal (t , expected , normalizeUnstructuredMap (list .Items [0 ].Object ))
472461
473462 t .Logf ("Getting a %s resource named %s in %q via %q should return that object" , resourceName , objName , targetCluster , cfg .Host )
474- kcptestinghelpers .Eventually (t , func () (bool , string ) {
475- obj , err := dynClient .Cluster (targetCluster .Path ()).
476- Resource (wildwestv1alpha1 .SchemeGroupVersion .WithResource (resourceName )).
477- Get (ctx , objName , metav1.GetOptions {})
478- if err != nil {
479- return false , fmt .Sprintf ("failed to get: %v" , err )
480- }
481- actual := normalizeUnstructuredMap (obj .Object )
482- if ! reflect .DeepEqual (actual , expected ) {
483- return false , fmt .Sprintf ("get result mismatch:\n expected: %v\n actual: %v" , expected , actual )
484- }
485- return true , ""
486- }, wait .ForeverTestTimeout , time .Millisecond * 500 , "getting %s/%s in %q via %q" , resourceName , objName , targetCluster , cfg .Host )
463+ obj , err := dynClient .Cluster (targetCluster .Path ()).
464+ Resource (wildwestv1alpha1 .SchemeGroupVersion .WithResource (resourceName )).
465+ Get (ctx , objName , metav1.GetOptions {})
466+ require .NoError (t , err )
467+ require .Equal (t , expected , normalizeUnstructuredMap (obj .Object ))
487468}
488469
489470func normalizeUnstructuredMap (origObj map [string ]interface {}) map [string ]interface {} {
0 commit comments