Skip to content

Commit 59e8fa7

Browse files
committed
ensure same-cluster test works in 0.27 where we have to manually create the AEES
On-behalf-of: @SAP [email protected]
1 parent a718897 commit 59e8fa7

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

test/e2e/sync/apiexportendpointslice_test.go

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)