Skip to content

Commit 333068d

Browse files
committed
fix tests
On-behalf-of: @SAP [email protected]
1 parent c54314d commit 333068d

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

internal/sync/object_syncer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ func (s *objectSyncer) Sync(ctx context.Context, log *zap.SugaredLogger, source,
129129

130130
// The function above either created a new destination object or patched-in the missing labels,
131131
// in both cases do we want to requeue.
132-
s.recordEvent(ctx, source, dest, corev1.EventTypeNormal, "ObjectPlaced", "Object has been placed.")
133132
return true, nil
134133
}
135134

@@ -361,6 +360,9 @@ func (s *objectSyncer) ensureDestinationObject(ctx context.Context, log *zap.Sug
361360
}
362361
}
363362

363+
dest.object = destObj
364+
s.recordEvent(ctx, source, dest, corev1.EventTypeNormal, "ObjectPlaced", "Object has been placed.")
365+
364366
// remember the state of the object that we just created
365367
if err := s.stateStore.Put(ctx, source.object, source.clusterName, s.subresources); err != nil {
366368
return fmt.Errorf("failed to update sync state: %w", err)

test/e2e/apiexport/apiexport_test.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ func TestPermissionsClaims(t *testing.T) {
114114
t.Fatalf("Failed to wait for APIExport to be updated: %v", err)
115115
}
116116

117-
if claims := apiExport.Spec.PermissionClaims; len(claims) > 0 {
118-
t.Fatalf("APIExport should have no permissions claims, but has %v", claims)
117+
if claims := apiExport.Spec.PermissionClaims; len(claims) > 1 {
118+
t.Fatalf("APIExport should have only events permissions claims, but has %v", claims)
119119
}
120120

121121
// let's configure some related resources
@@ -206,7 +206,8 @@ func TestPermissionsClaims(t *testing.T) {
206206
return false, err
207207
}
208208

209-
return len(apiExport.Spec.PermissionClaims) == 3, nil
209+
// 4 = events (always) + configmaps + secrets + namespaces (because of configmaps and secrets)
210+
return len(apiExport.Spec.PermissionClaims) == 4, nil
210211
})
211212
if err != nil {
212213
t.Fatalf("Failed to wait for APIExport to be updated: %v", err)
@@ -220,6 +221,13 @@ func TestPermissionsClaims(t *testing.T) {
220221
},
221222
All: true,
222223
},
224+
{
225+
GroupResource: kcpapisv1alpha1.GroupResource{
226+
Group: "",
227+
Resource: "events",
228+
},
229+
All: true,
230+
},
223231
{
224232
GroupResource: kcpapisv1alpha1.GroupResource{
225233
Group: "",
@@ -331,6 +339,13 @@ func TestExistingPermissionsClaimsAreKept(t *testing.T) {
331339
},
332340
All: true,
333341
},
342+
{
343+
GroupResource: kcpapisv1alpha1.GroupResource{
344+
Group: "",
345+
Resource: "events",
346+
},
347+
All: true,
348+
},
334349
{
335350
GroupResource: kcpapisv1alpha1.GroupResource{
336351
Group: "",

0 commit comments

Comments
 (0)