Skip to content

Commit

Permalink
error message uses correct flag (#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
jemishp authored and kushalmalani committed Mar 20, 2023
1 parent 44fb883 commit 2b51dd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cloud/deployment/fromfile/fromfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func CreateOrUpdate(inputFile, action string, client astro.Client, out io.Writer
// check if deployment exists
if deploymentExists(existingDeployments, formattedDeployment.Deployment.Configuration.Name) {
// create does not allow updating existing deployments
errHelp = fmt.Sprintf("use deployment update --from-file %s instead", inputFile)
errHelp = fmt.Sprintf("use deployment update --deployment-file %s instead", inputFile)
return fmt.Errorf("deployment: %s %w: %s", formattedDeployment.Deployment.Configuration.Name,
errCannotUpdateExistingDeployment, errHelp)
}
Expand All @@ -117,7 +117,7 @@ func CreateOrUpdate(inputFile, action string, client astro.Client, out io.Writer
// check if deployment does not exist
if !deploymentExists(existingDeployments, formattedDeployment.Deployment.Configuration.Name) {
// update does not allow creating new deployments
errHelp = fmt.Sprintf("use deployment create --from-file %s instead", inputFile)
errHelp = fmt.Sprintf("use deployment create --deployment-file %s instead", inputFile)
return fmt.Errorf("deployment: %s %w: %s", formattedDeployment.Deployment.Configuration.Name,
errNotFound, errHelp)
}
Expand Down
4 changes: 2 additions & 2 deletions cloud/deployment/fromfile/fromfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ deployment:
mockClient.On("ListClusters", orgID).Return(existingClusters, nil)
mockClient.On("ListDeployments", orgID, "").Return(existingDeployments, nil)
err = CreateOrUpdate("deployment.yaml", "create", mockClient, nil)
assert.ErrorContains(t, err, "deployment: test-deployment-label already exists: use deployment update --from-file deployment.yaml instead")
assert.ErrorContains(t, err, "deployment: test-deployment-label already exists: use deployment update --deployment-file deployment.yaml instead")
mockClient.AssertExpectations(t)
})
t.Run("returns an error if creating deployment input fails", func(t *testing.T) {
Expand Down Expand Up @@ -2147,7 +2147,7 @@ deployment:
mockClient.On("ListClusters", orgID).Return(existingClusters, nil)
mockClient.On("ListDeployments", orgID, "").Return([]astro.Deployment{}, nil)
err = CreateOrUpdate("deployment.yaml", "update", mockClient, nil)
assert.ErrorContains(t, err, "deployment: test-deployment-label does not exist: use deployment create --from-file deployment.yaml instead")
assert.ErrorContains(t, err, "deployment: test-deployment-label does not exist: use deployment create --deployment-file deployment.yaml instead")
mockClient.AssertExpectations(t)
})
t.Run("returns an error if creating update deployment input fails", func(t *testing.T) {
Expand Down

0 comments on commit 2b51dd9

Please sign in to comment.