Skip to content

Support multiple arguments on revision delete#657

Merged
knative-prow-robot merged 13 commits intoknative:masterfrom
wslyln:multiple-revision-delete
Feb 14, 2020
Merged

Support multiple arguments on revision delete#657
knative-prow-robot merged 13 commits intoknative:masterfrom
wslyln:multiple-revision-delete

Conversation

@wslyln
Copy link
Copy Markdown
Contributor

@wslyln wslyln commented Feb 12, 2020

Addresses #317

Release note:

  • 🧽 Support multiple revision names on kn revision delete

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Feb 12, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 12, 2020
Copy link
Copy Markdown
Contributor

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/retest

thanks!

just a few minor changes requested

Comment thread pkg/kn/commands/revision/delete.go Outdated
Comment thread test/e2e/revision_test.go Outdated
Comment thread test/e2e/revision_test.go Outdated
Comment on lines +104 to +111
existRevision1 := revisionNames[0]
existRevision2 := revisionNames[1]
nonexistRevision := revisionNames[2]
out, err := test.kn.RunWithOpts([]string{"revision", "list"}, runOpts{NoNamespace: false})
assert.NilError(t, err)
assert.Check(t, strings.Contains(out, existRevision1), "Required revision1 does not exist")
assert.Check(t, strings.Contains(out, existRevision2), "Required revision2 does not exist")
assert.Check(t, !strings.Contains(out, nonexistRevision), "Nonexistent revision does exist")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this block is not required as if the revision doesnt exist, it should be tested in delete check below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep it as if the tests before this one are moved around there might not be 2 revisions. Though I'll remove it if you feel strongly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, your tests should generate revisions by its own and not rely on generating test artifacts by other tests.

Comment thread test/e2e/revision_test.go Outdated
Copy link
Copy Markdown
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a rewording request.

Comment thread pkg/kn/commands/revision/delete.go Outdated
Comment thread pkg/kn/commands/revision/delete.go Outdated
@rhuss
Copy link
Copy Markdown
Contributor

rhuss commented Feb 12, 2020

/retest

The test should be more stable when #661 is merged.

@rhuss
Copy link
Copy Markdown
Contributor

rhuss commented Feb 12, 2020

\u0026#xA;# knative.dev/client/test/e2e [knative.dev/client/test/e2e.test]\u0026#xA;test/e2e/revision_test.go:107:96: undefined: nonexistRevision\u0026#xA;test/e2e/revision_test.go:111:73: undefined: nonexistRevision\u0026#xA;

Copy link
Copy Markdown
Contributor

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    --- FAIL: TestRevision/delete_three_revisions_with_one_revision_a_nonexistent (15.36s)
        revision_test.go:111: assertion failed: 
            Actual output: Revision 'hello-zxgvs-1' deleted in namespace 'kne2etests0'.
            Revision 'hello-vvpnh-2' deleted in namespace 'kne2etests0'.
            revisions.serving.knative.dev "hello-nonexist" not found.
            
            Missing strings: successfully: Failed to get 'successfully deleted' first revision message
        revision_test.go:112: assertion failed: 
            Actual output: Revision 'hello-zxgvs-1' deleted in namespace 'kne2etests0'.
            Revision 'hello-vvpnh-2' deleted in namespace 'kne2etests0'.
            revisions.serving.knative.dev "hello-nonexist" not found.
            
            Missing strings: successfully: Failed to get 'successfully deleted' second revision message

looks like tests need to be updated with change in messages

@wslyln
Copy link
Copy Markdown
Contributor Author

wslyln commented Feb 13, 2020

fixed the tests, and actually checked the tests TestRevisions before pushing :)

@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/commands/revision/delete.go 75.0% 76.5% 1.5

@wslyln
Copy link
Copy Markdown
Contributor Author

wslyln commented Feb 13, 2020

/retest

Copy link
Copy Markdown
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 14, 2020
Copy link
Copy Markdown
Contributor

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

Thanks!

revName1 := "foo-12345"
revName2 := "foo-67890"
revName3 := "foo-abcde"
action, _, output, err := fakeRevisionDelete([]string{"revision", "delete", revName1, revName2, revName3})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at this unit tests framework we're using now https://github.com/knative/client/blob/master/pkg/kn/commands/service/service_update_mock_test.go#L32

We should eventually streamline all the unit tests to use single framework.

Comment thread test/e2e/revision_test.go
}

func (test *e2eTest) revisionDelete(t *testing.T, serviceName string) {
revName := test.findRevision(t, serviceName)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread test/e2e/revision_test.go

t.Run("delete latest revision from hello service and return no error", func(t *testing.T) {
test.revisionDelete(t, "hello")
revName := test.findRevision(t, "hello")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 14, 2020
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maximilien, navidshaikh, wslyln

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [maximilien,navidshaikh]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot merged commit 12d718e into knative:master Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants