Skip to content

Commit

Permalink
Fix: Throw error while rejecting a package which is not (#4022)
Browse files Browse the repository at this point in the history
proposed/deletion-proposed
  • Loading branch information
bharat-m1 committed Aug 15, 2023
1 parent 30272c9 commit ef044e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commands/alpha/rpkg/reject/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ func (r *runner) runE(_ *cobra.Command, args []string) error {
fmt.Fprintf(r.Command.OutOrStderr(), "%s no longer proposed for deletion\n", name)
}
default:
fmt.Fprintf(r.Command.ErrOrStderr(), "cannot reject %s with lifecycle '%s'\n", name, pr.Spec.Lifecycle)
msg := fmt.Sprintf("cannot reject %s with lifecycle '%s'", name, pr.Spec.Lifecycle)
messages = append(messages, msg)
fmt.Fprintln(r.Command.ErrOrStderr(), msg)
}
}

Expand Down
3 changes: 3 additions & 0 deletions e2e/testdata/porch/rpkg-lifecycle/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ commands:
- --namespace=rpkg-lifecycle
stderr: |
cannot reject git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 with lifecycle 'Published'
Error: errors:
cannot reject git-017a8366a5e0d9b35ae6dc489d4d3f68046d6034 with lifecycle 'Published'
exitCode: 1
- args:
- alpha
- rpkg
Expand Down

0 comments on commit ef044e0

Please sign in to comment.