@@ -1676,13 +1676,14 @@ func TestClusterTopologyValidation(t *testing.T) {
16761676 utilfeature .SetFeatureGateDuringTest (t , feature .Gates , feature .ClusterTopology , true )
16771677
16781678 tests := []struct {
1679- name string
1680- in * clusterv1.Cluster
1681- old * clusterv1.Cluster
1682- additionalObjects []client.Object
1683- clusterClassVersions []string
1684- expectErr bool
1685- expectWarning bool
1679+ name string
1680+ in * clusterv1.Cluster
1681+ old * clusterv1.Cluster
1682+ additionalObjects []client.Object
1683+ clusterClassVersions []string
1684+ generateUpgradePlanExtension string
1685+ expectErr bool
1686+ expectWarning bool
16861687 }{
16871688 {
16881689 name : "should return error when topology does not have class" ,
@@ -1899,6 +1900,31 @@ func TestClusterTopologyValidation(t *testing.T) {
18991900 Build (),
19001901 },
19011902 },
1903+ {
1904+ name : "should allow upgrading >1 minor version when generateUpgradePlan extension is defined in CC" ,
1905+ old : builder .Cluster ("fooboo" , "cluster1" ).
1906+ WithControlPlane (builder .ControlPlane ("fooboo" , "cluster1-cp" ).Build ()).
1907+ WithTopology (builder .ClusterTopology ().
1908+ WithClass ("foo" ).
1909+ WithVersion ("v1.2.3" ).
1910+ Build ()).
1911+ Build (),
1912+ in : builder .Cluster ("fooboo" , "cluster1" ).
1913+ WithControlPlane (builder .ControlPlane ("fooboo" , "cluster1-cp" ).Build ()).
1914+ WithTopology (builder .ClusterTopology ().
1915+ WithClass ("foo" ).
1916+ WithVersion ("v1.4.0" ).
1917+ Build ()).
1918+ Build (),
1919+ generateUpgradePlanExtension : "foo" ,
1920+ additionalObjects : []client.Object {
1921+ // Note: CRD is needed to look up the apiVersion from contract labels.
1922+ builder .GenericControlPlaneCRD ,
1923+ builder .ControlPlane ("fooboo" , "cluster1-cp" ).WithVersion ("v1.2.3" ).
1924+ WithStatusFields (map [string ]interface {}{"status.version" : "v1.2.3" }).
1925+ Build (),
1926+ },
1927+ },
19021928 {
19031929 name : "should return error when duplicated MachineDeployments names exists in a Topology" ,
19041930 expectErr : true ,
@@ -2246,6 +2272,7 @@ func TestClusterTopologyValidation(t *testing.T) {
22462272 if tt .clusterClassVersions != nil {
22472273 class .Spec .KubernetesVersions = tt .clusterClassVersions
22482274 }
2275+ class .Spec .Upgrade .External .GenerateUpgradePlanExtension = tt .generateUpgradePlanExtension
22492276
22502277 // Mark this condition to true so the webhook sees the ClusterClass as up to date.
22512278 conditions .Set (class , metav1.Condition {
0 commit comments