Skip to content

Commit 8bec387

Browse files
committed
post-rebase fixes
On-behalf-of: @SAP [email protected]
1 parent e000156 commit 8bec387

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

internal/controller/apiresourceschema/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (r *Reconciler) reconcile(ctx context.Context, log *zap.SugaredLogger, pubR
179179

180180
log.With("name", arsName).Info("Creating APIResourceSchema…")
181181

182-
if err := r.kcpClient.Create(wsCtx, ars); err != nil {
182+
if err := r.kcpClient.Create(ctx, ars); err != nil {
183183
return nil, fmt.Errorf("failed to create APIResourceSchema: %w", err)
184184
}
185185
} else if err != nil {

internal/controller/sync/controller.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request mcreconcile.Request)
220220
}
221221

222222
// sync main object
223-
mutator := mutation.NewMutator(r.pubRes.Spec.Mutation)
224-
225-
syncer, err := sync.NewResourceSyncer(log, r.localClient, vwClient, r.pubRes, r.localCRD, mutator, r.stateNamespace, r.agentName)
223+
syncer, err := sync.NewResourceSyncer(log, r.localClient, vwClient, r.pubRes, r.localCRD, mutation.NewMutator, r.stateNamespace, r.agentName)
226224
if err != nil {
227225
return reconcile.Result{}, fmt.Errorf("failed to create syncer: %w", err)
228226
}

test/e2e/sync/primary_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ spec:
299299

300300
utils.WaitForBoundAPI(t, ctx, teamClient, crontabsGVR)
301301

302-
if err := teamClient.Create(ctx, yamlToUnstructured(t, crontabYAML)); err != nil {
302+
if err := teamClient.Create(ctx, utils.YAMLToUnstructured(t, crontabYAML)); err != nil {
303303
t.Fatalf("Failed to create %s's CronTab in kcp: %v", team, err)
304304
}
305305
}

test/e2e/sync/related_test.go

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

Comments
 (0)