Skip to content

Commit

Permalink
Adjust porchctl unit test for the slightly changed output
Browse files Browse the repository at this point in the history
  • Loading branch information
kispaljr committed Aug 23, 2024
1 parent c0f45f7 commit 74aaa44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/cli/commands/rpkg/propose/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestCmd(t *testing.T) {
lc: porchapi.PackageRevisionLifecycleDraft,
},
"Cannot propose package": {
output: "cannot propose Published package\n",
output: pkgRevName + " failed (cannot propose Published package)\n",
lc: porchapi.PackageRevisionLifecyclePublished,
wantErr: true,
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/cli/commands/rpkg/proposedelete/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ func TestCmd(t *testing.T) {
ns string
}{
"Package not found in ns": {
output: pkgRevName + " failed (packagerevisions.porch.kpt.dev \"" + pkgRevName + "\" not found)\n",
ns: "doesnotexist",
wantErr: true,
},
"Package not published": {
output: "can only propose published packages for deletion; package " + pkgRevName + " is not published\n",
output: pkgRevName + " failed (can only propose published packages for deletion; package " + pkgRevName + " is not published)\n",
ns: "ns",
wantErr: true,
},
Expand Down
7 changes: 4 additions & 3 deletions pkg/cli/commands/rpkg/reject/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestCmd(t *testing.T) {
fakeclient client.WithWatch
}{
"Package not found in ns": {
output: pkgRevName + " failed (packagerevisions.porch.kpt.dev \"" + pkgRevName + "\" not found)\n",
wantErr: true,
fakeclient: fake.NewClientBuilder().WithScheme(scheme).
WithObjects(&porchapi.PackageRevision{
Expand Down Expand Up @@ -93,7 +94,7 @@ func TestCmd(t *testing.T) {
},
"Reject draft package": {
wantErr: true,
output: "cannot reject " + pkgRevName + " with lifecycle 'Draft'\n",
output: pkgRevName + " failed (cannot reject " + pkgRevName + " with lifecycle 'Draft')\n",
fakeclient: fake.NewClientBuilder().WithScheme(scheme).
WithObjects(&porchapi.PackageRevision{
TypeMeta: metav1.TypeMeta{
Expand All @@ -111,7 +112,7 @@ func TestCmd(t *testing.T) {
},
"Reject published package": {
wantErr: true,
output: "cannot reject " + pkgRevName + " with lifecycle 'Published'\n",
output: pkgRevName + " failed (cannot reject " + pkgRevName + " with lifecycle 'Published')\n",
fakeclient: fake.NewClientBuilder().WithScheme(scheme).
WithObjects(&porchapi.PackageRevision{
TypeMeta: metav1.TypeMeta{
Expand All @@ -128,7 +129,7 @@ func TestCmd(t *testing.T) {
}}).Build(),
},
"Reject proposed package": {
output: pkgRevName + " rejected\n",
output: pkgRevName + " no longer proposed for approval\n",
fakeclient: fake.NewClientBuilder().WithInterceptorFuncs(interceptor.Funcs{
//fake subresourceupdate
SubResourceUpdate: func(ctx context.Context, client client.Client, subResourceName string, obj client.Object, opts ...client.SubResourceUpdateOption) error {
Expand Down

0 comments on commit 74aaa44

Please sign in to comment.