Skip to content

Commit 5373b4a

Browse files
Yuvaraj Kakaraparthisbueringer
authored andcommitted
self-hosted e2e should check managed fields
1 parent fcda11d commit 5373b4a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/e2e/self_hosted.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,26 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
226226
Namespace: namespace.Name,
227227
})
228228

229+
// Note: clusterctl should restore the managedFields to the same as before the move,
230+
// and thus removing any managedField entries with clusterctl as a manager. This should happen
231+
// for all the objects processed by move, but for sake of simplicity we test only the Cluster
232+
// object. The Cluster object has special processing for the paused field during the move to
233+
// avoid having clusterctl as the manager of the field.
234+
log.Logf("Ensure clusterctl does not take ownership on any fields on the self-hosted cluster")
235+
selfHostedCluster := framework.GetClusterByName(ctx, framework.GetClusterByNameInput{
236+
Getter: selfHostedClusterProxy.GetClient(),
237+
Name: cluster.Name,
238+
Namespace: selfHostedNamespace.Name,
239+
})
240+
hasClusterctlManagedFields := false
241+
for _, managedField := range selfHostedCluster.GetManagedFields() {
242+
if managedField.Manager == "clusterctl" {
243+
hasClusterctlManagedFields = true
244+
break
245+
}
246+
}
247+
Expect(hasClusterctlManagedFields).To(BeFalse(), "clusterctl should not manage any fields on the Cluster after the move")
248+
229249
log.Logf("Waiting for the cluster to be reconciled after moving to self hosted")
230250
selfHostedCluster = framework.DiscoveryAndWaitForCluster(ctx, framework.DiscoveryAndWaitForClusterInput{
231251
Getter: selfHostedClusterProxy.GetClient(),

0 commit comments

Comments
 (0)