@@ -595,7 +595,7 @@ func TestSyncRelatedMultiObjects(t *testing.T) {
595595 // the name of this testcase
596596 name string
597597 // the org workspace everything should happen in
598- workspace logicalcluster. Name
598+ workspace string
599599 // the configuration for the related resource
600600 relatedConfig syncagentv1alpha1.RelatedResourceSpec
601601 // the primary object created by the user in kcp
@@ -853,25 +853,24 @@ func TestSyncRelatedMultiObjects(t *testing.T) {
853853 }
854854
855855 // fake operator: create credential Secrets
856- teamCtx := kontext .WithCluster (ctx , logicalcluster .Name (fmt .Sprintf ("root:%s:team-1" , testcase .workspace )))
857- kcpClient := utils .GetKcpAdminClusterClient (t )
856+ kcpClusterClient := utils .GetKcpAdminClusterClient (t )
857+
858+ teamClusterPath := logicalcluster .NewPath ("root" ).Join (testcase .workspace ).Join ("team-1" )
859+ teamClient := kcpClusterClient .Cluster (teamClusterPath )
858860
859861 originClient := envtestClient
860- originContext := ctx
861- destClient := kcpClient
862- destContext := teamCtx
862+ destClient := teamClient
863863
864864 if testcase .relatedConfig .Origin == syncagentv1alpha1 .RelatedResourceOriginKcp {
865865 originClient , destClient = destClient , originClient
866- originContext , destContext = destContext , originContext
867866 }
868867
869868 for _ , relatedObject := range testcase .sourceRelatedObjects {
870869 t .Logf ("Creating credential Secret on the %s side…" , testcase .relatedConfig .Origin )
871870
872- ensureNamespace (t , originContext , originClient , relatedObject .Namespace )
871+ ensureNamespace (t , ctx , originClient , relatedObject .Namespace )
873872
874- if err := originClient .Create (originContext , & relatedObject ); err != nil {
873+ if err := originClient .Create (ctx , & relatedObject ); err != nil {
875874 t .Fatalf ("Failed to create Secret %s: %v" , relatedObject .Name , err )
876875 }
877876 }
@@ -880,7 +879,7 @@ func TestSyncRelatedMultiObjects(t *testing.T) {
880879 utils .RunAgent (ctx , t , "bob" , orgKubconfig , envtestKubeconfig , apiExportName )
881880
882881 // wait until the API is available
883- utils .WaitForBoundAPI (t , teamCtx , kcpClient , schema.GroupVersionResource {
882+ utils .WaitForBoundAPI (t , ctx , teamClient , schema.GroupVersionResource {
884883 Group : apiExportName ,
885884 Version : "v1" ,
886885 Resource : "backups" ,
@@ -893,7 +892,7 @@ func TestSyncRelatedMultiObjects(t *testing.T) {
893892 remoteBackup .SetAPIVersion ("kcp.example.com/v1" )
894893 remoteBackup .SetKind ("Backup" )
895894
896- if err := kcpClient .Create (teamCtx , remoteBackup ); err != nil {
895+ if err := teamClient .Create (ctx , remoteBackup ); err != nil {
897896 t .Fatalf ("Failed to create Backup in kcp: %v" , err )
898897 }
899898
@@ -912,7 +911,7 @@ func TestSyncRelatedMultiObjects(t *testing.T) {
912911 return nil
913912 }
914913
915- err := wait .PollUntilContextTimeout (destContext , 2 * time .Second , 30 * time .Second , false , func (ctx context.Context ) (done bool , err error ) {
914+ err := wait .PollUntilContextTimeout (ctx , 2 * time .Second , 30 * time .Second , false , func (ctx context.Context ) (done bool , err error ) {
916915 var errs []string
917916
918917 for _ , expectedObj := range testcase .expectedSyncedRelatedObjects {
0 commit comments