Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple arguments on revision delete #657

Merged
merged 13 commits into from
Feb 14, 2020

Conversation

wslyln
Copy link
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
Collaborator

@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

pkg/kn/commands/revision/delete.go Outdated Show resolved Hide resolved
test/e2e/revision_test.go Outdated Show resolved Hide resolved
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
Collaborator

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
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
Collaborator

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.

test/e2e/revision_test.go Outdated Show resolved Hide resolved
Copy link
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.

pkg/kn/commands/revision/delete.go Outdated Show resolved Hide resolved
pkg/kn/commands/revision/delete.go Outdated Show resolved Hide resolved
@rhuss
Copy link
Contributor

rhuss commented Feb 12, 2020

/retest

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

@rhuss
Copy link
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
Collaborator

@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
Contributor Author

wslyln commented Feb 13, 2020

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

@knative-metrics-robot
Copy link

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
Contributor Author

wslyln commented Feb 13, 2020

/retest

Copy link
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
Collaborator

@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
Collaborator

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.

@@ -76,18 +89,31 @@ func (test *e2eTest) revisionListWithService(t *testing.T, serviceNames ...strin
}
}

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

Choose a reason for hiding this comment

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

👍

@@ -50,7 +51,19 @@ func TestRevision(t *testing.T) {
})

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
Collaborator

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
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

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
coryrc pushed a commit to coryrc/client that referenced this pull request May 14, 2020
mgencur pushed a commit to openshift-knative/client that referenced this pull request Nov 21, 2022
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