Skip to content

Commit

Permalink
MGMT-14904: fix error code for ignition size validation (openshift#5291)
Browse files Browse the repository at this point in the history
On update InfraEnv, should return StatusBadRequest(400),
when discovery ignition image size validation fails.
  • Loading branch information
danielerez committed Oct 15, 2023
1 parent 16a1d72 commit 50a80e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/bminventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5013,7 +5013,7 @@ func (b *bareMetalInventory) UpdateInfraEnvInternal(ctx context.Context, params

// Validate discovery ignition after updating InfraEnv data
if err = b.validateDiscoveryIgnitionImageSize(ctx, infraEnv, params, tx, log); err != nil {
return nil, err
return nil, common.NewApiError(http.StatusBadRequest, err)
}

tx.Commit()
Expand Down
4 changes: 1 addition & 3 deletions internal/bminventory/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12480,9 +12480,7 @@ var _ = Describe("UpdateInfraEnv - Ignition", func() {
InfraEnvUpdateParams: &models.InfraEnvUpdateParams{IgnitionConfigOverride: override},
}
response := bm.UpdateInfraEnv(ctx, params)
Expect(response).To(BeAssignableToTypeOf(common.NewApiError(http.StatusBadRequest, errors.Errorf(""))))
err = response.(*common.ApiErrorResponse)
Expect(err.Error()).To(ContainSubstring("over the maximum allowable size"))
verifyApiErrorString(response, http.StatusBadRequest, "over the maximum allowable size")
})
})

Expand Down

0 comments on commit 50a80e6

Please sign in to comment.