Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Feb 8, 2024
1 parent f23b5cd commit e0e2cec
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal/webhooks/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e0e2cec

Please sign in to comment.