Skip to content

Commit c88b073

Browse files
committed
adjust tests
On-behalf-of: @SAP [email protected]
1 parent 5ee93b2 commit c88b073

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

test/e2e/apiresourceschema/apiresourceschema_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,11 @@ func TestNonCRDResource(t *testing.T) {
405405
Version: "v1",
406406
Kind: "Role",
407407
},
408+
Projection: &syncagentv1alpha1.ResourceProjection{
409+
// must project to a different API group, because kubernetes will reject CRDs in those
410+
// known core groups with the "api-approved.kubernetes.io" annotation on them.
411+
Group: apiExportName,
412+
},
408413
},
409414
}
410415

test/e2e/sync/primary_test.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
func TestSyncSimpleObject(t *testing.T) {
5050
const (
5151
apiExportName = "kcp.example.com"
52+
kcpGroupName = "kcp.example.com"
5253
orgWorkspace = "sync-simple"
5354
)
5455

@@ -80,6 +81,9 @@ func TestSyncSimpleObject(t *testing.T) {
8081
Name: "$remoteName",
8182
Namespace: "synced-$remoteNamespace",
8283
},
84+
Projection: &syncagentv1alpha1.ResourceProjection{
85+
Group: kcpGroupName,
86+
},
8387
},
8488
}
8589

@@ -94,7 +98,7 @@ func TestSyncSimpleObject(t *testing.T) {
9498
teamCtx := kontext.WithCluster(ctx, logicalcluster.Name(fmt.Sprintf("root:%s:team-1", orgWorkspace)))
9599
kcpClient := utils.GetKcpAdminClusterClient(t)
96100
utils.WaitForBoundAPI(t, teamCtx, kcpClient, schema.GroupVersionResource{
97-
Group: apiExportName,
101+
Group: kcpGroupName,
98102
Version: "v1",
99103
Resource: "crontabs",
100104
})
@@ -135,6 +139,7 @@ spec:
135139
func TestLocalChangesAreKept(t *testing.T) {
136140
const (
137141
apiExportName = "kcp.example.com"
142+
kcpGroupName = "kcp.example.com"
138143
orgWorkspace = "sync-undo-local-changes"
139144
)
140145

@@ -166,6 +171,9 @@ func TestLocalChangesAreKept(t *testing.T) {
166171
Name: "$remoteName",
167172
Namespace: "synced-$remoteNamespace",
168173
},
174+
Projection: &syncagentv1alpha1.ResourceProjection{
175+
Group: kcpGroupName,
176+
},
169177
},
170178
}
171179

@@ -180,7 +188,7 @@ func TestLocalChangesAreKept(t *testing.T) {
180188
teamCtx := kontext.WithCluster(ctx, logicalcluster.Name(fmt.Sprintf("root:%s:team-1", orgWorkspace)))
181189
kcpClient := utils.GetKcpAdminClusterClient(t)
182190
utils.WaitForBoundAPI(t, teamCtx, kcpClient, schema.GroupVersionResource{
183-
Group: apiExportName,
191+
Group: kcpGroupName,
184192
Version: "v1",
185193
Resource: "crontabs",
186194
})
@@ -337,6 +345,7 @@ func yamlToUnstructured(t *testing.T, data string) *unstructured.Unstructured {
337345
func TestResourceFilter(t *testing.T) {
338346
const (
339347
apiExportName = "kcp.example.com"
348+
kcpGroupName = "kcp.example.com"
340349
orgWorkspace = "sync-resource-filter"
341350
)
342351

@@ -368,6 +377,9 @@ func TestResourceFilter(t *testing.T) {
368377
Name: "$remoteName",
369378
Namespace: "synced-$remoteNamespace",
370379
},
380+
Projection: &syncagentv1alpha1.ResourceProjection{
381+
Group: kcpGroupName,
382+
},
371383
Filter: &syncagentv1alpha1.ResourceFilter{
372384
Resource: &metav1.LabelSelector{
373385
MatchLabels: map[string]string{
@@ -389,7 +401,7 @@ func TestResourceFilter(t *testing.T) {
389401
teamCtx := kontext.WithCluster(ctx, logicalcluster.Name(fmt.Sprintf("root:%s:team-1", orgWorkspace)))
390402
kcpClient := utils.GetKcpAdminClusterClient(t)
391403
utils.WaitForBoundAPI(t, teamCtx, kcpClient, schema.GroupVersionResource{
392-
Group: apiExportName,
404+
Group: kcpGroupName,
393405
Version: "v1",
394406
Resource: "crontabs",
395407
})
@@ -454,6 +466,7 @@ spec:
454466
func TestSyncingOverlyLongNames(t *testing.T) {
455467
const (
456468
apiExportName = "kcp.example.com"
469+
kcpGroupName = "kcp.example.com"
457470
orgWorkspace = "sync-long-names"
458471
)
459472

@@ -485,6 +498,9 @@ func TestSyncingOverlyLongNames(t *testing.T) {
485498
Name: "$remoteName",
486499
Namespace: "synced-$remoteNamespace",
487500
},
501+
Projection: &syncagentv1alpha1.ResourceProjection{
502+
Group: kcpGroupName,
503+
},
488504
},
489505
}
490506

@@ -499,7 +515,7 @@ func TestSyncingOverlyLongNames(t *testing.T) {
499515
teamCtx := kontext.WithCluster(ctx, logicalcluster.Name(fmt.Sprintf("root:%s:team-1", orgWorkspace)))
500516
kcpClient := utils.GetKcpAdminClusterClient(t)
501517
utils.WaitForBoundAPI(t, teamCtx, kcpClient, schema.GroupVersionResource{
502-
Group: apiExportName,
518+
Group: kcpGroupName,
503519
Version: "v1",
504520
Resource: "crontabs",
505521
})

test/e2e/sync/related_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@ func TestSyncRelatedObjects(t *testing.T) {
484484
Name: "$remoteName",
485485
Namespace: "synced-$remoteNamespace",
486486
},
487+
Projection: &syncagentv1alpha1.ResourceProjection{
488+
Group: "kcp.example.com",
489+
},
487490
Related: []syncagentv1alpha1.RelatedResourceSpec{testcase.relatedConfig},
488491
},
489492
}

0 commit comments

Comments
 (0)