From e0e2ceccd1545a736afd157f9cf3da17a3ef1a54 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Thu, 8 Feb 2024 10:08:40 +0100 Subject: [PATCH] add test case --- internal/webhooks/cluster_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/internal/webhooks/cluster_test.go b/internal/webhooks/cluster_test.go index cab10fc33144..db0b4283e1c8 100644 --- a/internal/webhooks/cluster_test.go +++ b/internal/webhooks/cluster_test.go @@ -1294,6 +1294,27 @@ func TestClusterTopologyValidation(t *testing.T) { }).WithVersion("v1.19.1").Build(), }, }, + { + name: "should skip validation if cluster kcp is not yet provisioned but annotation is set", + expectErr: false, + old: builder.Cluster("fooboo", "cluster1"). + WithControlPlane(builder.ControlPlane("fooboo", "cluster1-cp").Build()). + WithTopology(builder.ClusterTopology(). + WithClass("foo"). + WithVersion("v1.19.1"). + Build()). + Build(), + in: builder.Cluster("fooboo", "cluster1"). + WithAnnotations(map[string]string{clusterv1.ClusterTopologyUnsafeUpdateVersionAnnotation: "true"}). + WithTopology(builder.ClusterTopology(). + WithClass("foo"). + WithVersion("v1.20.2"). + Build()). + Build(), + additionalObjects: []client.Object{ + builder.ControlPlane("fooboo", "cluster1-cp").WithVersion("v1.18.1").Build(), + }, + }, { name: "should block update if cluster kcp is not yet provisioned", expectErr: true,