Skip to content

Commit a7e048a

Browse files
fix(frontend): preserve rebased resize preflight validation
Keep the rebased control plane resize branch on the validated inventory-preflight path and update the rebased tests to assert the normalized inventory errors without leaving a standalone follow-up fix commit. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 33851b8 commit a7e048a

3 files changed

Lines changed: 19 additions & 2 deletions

pkg/frontend/admin_openshiftcluster_resize_controlplane_recovery_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,8 @@ func TestRollbackAllFailsFastWhenEtcdUnhealthyBetweenNodes(t *testing.T) {
558558
}
559559

560560
func TestAdminReplyPreservesWrappedCloudError(t *testing.T) {
561+
t.Parallel()
562+
561563
recorder := httptest.NewRecorder()
562564
_, log := testlog.New()
563565

pkg/frontend/admin_openshiftcluster_vmresize_pre_validation.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ func (f *frontend) preResizeControlPlaneVMsValidation(
182182
return nil, preResizeControlPlaneValidationError(details)
183183
}
184184

185+
collect(validateResizeControlPlaneInventory(ctx, log, k, a, doc.OpenShiftCluster.Properties.ClusterProfile.ResourceGroupID))
186+
if len(details) > 0 {
187+
return nil, preResizeControlPlaneValidationError(details)
188+
}
189+
185190
return json.Marshal("All pre-flight checks passed")
186191
}
187192

@@ -218,6 +223,7 @@ func validateResizeControlPlaneInventory(
218223

219224
return nil
220225
}
226+
221227
// defaultValidateResizeQuota creates an FP-authorized compute usage client and
222228
// delegates to checkResizeComputeQuota. Injected via f.validateResizeQuota so
223229
// tests can swap it with quotaCheckDisabled.

pkg/frontend/admin_openshiftcluster_vmresize_pre_validation_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func TestValidateResizeControlPlaneInventory(t *testing.T) {
331331

332332
err := validateResizeControlPlaneInventory(ctx, log, k, a, "/subscriptions/000/resourceGroups/test-cluster")
333333
assertErrorContainsAll(t, err,
334-
"Control plane machine inventory is inconsistent",
334+
"control plane machine inventory is inconsistent",
335335
"All machines should have the same size",
336336
)
337337
})
@@ -357,10 +357,16 @@ func TestValidateResizeControlPlaneInventory(t *testing.T) {
357357
controlPlaneNode("master-1", "Standard_D16s_v5", "Standard_D16s_v5", true, false),
358358
controlPlaneNode("master-2", "Standard_D8s_v3", "Standard_D8s_v3", true, false),
359359
), nil)
360+
a.EXPECT().GetVirtualMachine(gomock.Any(), "test-cluster", "master-0", mgmtcompute.InstanceView).
361+
Return(inventoryValidationVM("Standard_D8s_v3", "1"), nil)
362+
a.EXPECT().GetVirtualMachine(gomock.Any(), "test-cluster", "master-1", mgmtcompute.InstanceView).
363+
Return(inventoryValidationVM("Standard_D8s_v3", "2"), nil)
364+
a.EXPECT().GetVirtualMachine(gomock.Any(), "test-cluster", "master-2", mgmtcompute.InstanceView).
365+
Return(inventoryValidationVM("Standard_D8s_v3", "3"), nil)
360366

361367
err := validateResizeControlPlaneInventory(ctx, log, k, a, "/subscriptions/000/resourceGroups/test-cluster")
362368
assertErrorContainsAll(t, err,
363-
"Control plane machine and node inventory is inconsistent",
369+
"control plane machine and node inventory is inconsistent",
364370
"machine master-1 has size Standard_D8s_v3 in its spec, however node has instance-type Standard_D16s_v5",
365371
)
366372
})
@@ -426,6 +432,7 @@ func TestPreResizeControlPlaneVMsValidationRejectsHeterogeneousInventory(t *test
426432
"All machines should have the same size",
427433
)
428434
}
435+
429436
func TestPreResizeControlPlaneVMsValidation(t *testing.T) {
430437
t.Parallel()
431438

@@ -1094,6 +1101,8 @@ func TestPreResizeControlPlaneVMsValidation(t *testing.T) {
10941101
}
10951102

10961103
func TestValidateResizeControlPlaneInventoryNormalizesJoinedErrorLineEndings(t *testing.T) {
1104+
t.Parallel()
1105+
10971106
ctx := context.Background()
10981107
ctrl := gomock.NewController(t)
10991108
defer ctrl.Finish()

0 commit comments

Comments
 (0)