Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 change state to pending state in case no corresponding APIResourceImp… #2931

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (e *apiCompatibleReconciler) reconcile(ctx context.Context, syncTarget *wor

downStreamSchema, ok := apiImportMap[gvr]
if !ok {
syncTarget.Status.SyncedResources[i].State = workloadv1alpha1.ResourceSchemaIncompatibleState
syncTarget.Status.SyncedResources[i].State = workloadv1alpha1.ResourceSchemaPendingState
continue
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestSyncTargetCompatibleReconcile(t *testing.T) {
}),
},
wantSyncedResources: []workloadv1alpha1.ResourceToSync{
{GroupResource: apisv1alpha1.GroupResource{Group: "apps", Resource: "deployments"}, Versions: []string{"v1"}, State: workloadv1alpha1.ResourceSchemaIncompatibleState},
{GroupResource: apisv1alpha1.GroupResource{Group: "apps", Resource: "deployments"}, Versions: []string{"v1"}, State: workloadv1alpha1.ResourceSchemaPendingState},
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/reconciler/locationworkspace/synctarget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestSyncTargetExport(t *testing.T) {
}

if syncTarget.Status.SyncedResources[0].Resource != "cowboys" ||
syncTarget.Status.SyncedResources[0].State != workloadv1alpha1.ResourceSchemaIncompatibleState {
syncTarget.Status.SyncedResources[0].State != workloadv1alpha1.ResourceSchemaPendingState {
Copy link
Member

@davidfestal davidfestal Apr 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not testing the incompatible state anymore, maybe an additional resource could be added that would be incompatible.
This could be done by:

  • creating an additional APIExport with 1 APIResourceSchema in a workspace
  • adding this APIExport in the list of APIExports of the SyncerFixture
  • adding the same CRD in the physical cluster (by WithDownstreamPreparation when creating the SyncerFixture), but with a small field of the CRD schema changed (for example changing string to int)
  • checking that this resource on the Synctarget is in the Incompatible state

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidfestal is this needs to be part of same PR?

return false
}

Expand Down