@@ -88,13 +88,31 @@ func TestAPIExportEndpointSliceSameCluster(t *testing.T) {
8888 t .Fatalf ("Failed to create PublishedResource: %v" , err )
8989 }
9090
91+ // In kcp 0.27, we have to manually create the AEES. To make this test work consistently with
92+ // 0.27 and later versions, we simply always create one.
93+ kcpClusterClient := utils .GetKcpAdminClusterClient (t )
94+ orgClient := kcpClusterClient .Cluster (logicalcluster .NewPath ("root" ).Join (orgWorkspace ))
95+
96+ endpointSlice := & kcpdevv1alpha1.APIExportEndpointSlice {
97+ ObjectMeta : metav1.ObjectMeta {
98+ Name : "dummy" ,
99+ },
100+ Spec : kcpdevv1alpha1.APIExportEndpointSliceSpec {
101+ APIExport : kcpdevv1alpha1.ExportBindingReference {
102+ Name : apiExportName ,
103+ },
104+ },
105+ }
106+
107+ t .Logf ("Creating APIExportEndpointSlice %q…" , endpointSlice .Name )
108+ if err := orgClient .Create (ctx , endpointSlice ); err != nil {
109+ t .Fatalf ("Failed to create APIExportEndpointSlice: %v" , err )
110+ }
111+
91112 // start the agent in the background to update the APIExport with the CronTabs API;
92- // use the export's name because kcp created an endpoint slice of the same name
93- utils .RunEndpointSliceAgent (ctx , t , "bob" , orgKubconfig , envtestKubeconfig , apiExportName )
113+ utils .RunEndpointSliceAgent (ctx , t , "bob" , orgKubconfig , envtestKubeconfig , endpointSlice .Name )
94114
95115 // wait until the API is available
96- kcpClusterClient := utils .GetKcpAdminClusterClient (t )
97-
98116 teamClusterPath := logicalcluster .NewPath ("root" ).Join (orgWorkspace ).Join ("team-1" )
99117 teamClient := kcpClusterClient .Cluster (teamClusterPath )
100118
0 commit comments