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

Add E2E tests for Service, Revision, Route #291

Merged
merged 2 commits into from
Jul 26, 2019

Conversation

mgencur
Copy link
Contributor

@mgencur mgencur commented Jul 24, 2019

  • service, revision, route describe and describe with print flags
  • route list with print flags
  • service create for a duplicate service

Fixes #

Proposed Changes

  • increase test coverage via new E2E tests

Release Note


* service, revision, route describe and describe with print flags
* route list with print flags
* service create for a duplicate service
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 24, 2019
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@mgencur: 0 warnings.

In response to this:

  • service, revision, route describe and describe with print flags
  • route list with print flags
  • service create for a duplicate service

Fixes #

Proposed Changes

  • increase test coverage via new E2E tests

Release Note


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 24, 2019
assert.Check(t, strings.Contains(out, serviceName), "The service does not exist yet")

_, err = test.kn.RunWithOpts([]string{"service", "create",
fmt.Sprintf("%s", serviceName),
Copy link
Collaborator

Choose a reason for hiding this comment

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

just use serviceName here ? No need for fmt.Sprintf

assert.NilError(t, err)

expectedName := fmt.Sprintf("service.serving.knative.dev/%s", serviceName)
assert.Check(t, strings.Contains(out, expectedName))
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be an exact string match IMO, i..e assert.Equal(t, out, expectedName)

Copy link
Collaborator

Choose a reason for hiding this comment

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

as this is not string manipulation and printing on the client side, but machine readable output

assert.NilError(t, err)

expectedName := fmt.Sprintf("route.serving.knative.dev/%s", routeName)
assert.Check(t, strings.Contains(out, expectedName))
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above about exact name matching

assert.Check(t, util.ContainsAll(out, serviceName))
}

func (test *e2eTest) serviceCreateDuplicate(t *testing.T, serviceName string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO, this particular test case doesn't belong to basic_workflow_test as the filename suggest, but kind of testing for error handling mechanism, we should probably create another workflow which specifically aims at error handling test cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you all decide to move this to a more thorough IT (I am ambivalent at this point), please do the same for suggestion above on delete service.

Copy link
Collaborator

Choose a reason for hiding this comment

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

should be addressed as part of resolution to #301

assert.NilError(t, err)

expectedName := fmt.Sprintf("revision.serving.knative.dev/%s", revName)
assert.Check(t, strings.Contains(out, expectedName))
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment as above, just check for exact match

@@ -38,9 +38,14 @@ func TestBasicWorkflow(t *testing.T) {
test.serviceCreate(t, "hello")
})

t.Run("create hello service again and get service already exists error", func(t *testing.T) {
test.serviceCreateDuplicate(t, "hello")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice nice, I wonder if we should also try to delete a service that’s already deleted? I would expect an error in case where service is already deleted (non-existent) and if the service is being deleted. Of course in the end the API should do the right thing and the client should return a “sensible” error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. Good point. I can add a test for deleting a non-existent service to this PR.

assert.Check(t, util.ContainsAll(out, serviceName))
}

func (test *e2eTest) serviceCreateDuplicate(t *testing.T, serviceName string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you all decide to move this to a more thorough IT (I am ambivalent at this point), please do the same for suggestion above on delete service.

@maximilien
Copy link
Contributor

/ok-to-test

@knative-prow-robot knative-prow-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jul 24, 2019
@maximilien
Copy link
Contributor

/retest

@mgencur
Copy link
Contributor Author

mgencur commented Jul 25, 2019

hey! Thanks for the reviews. I have fixed all things except moving the test. I also added one more test that checks deleting a non-existent service.
Regarding moving the test from the basic workflow, I spoke with @navidshaikh and I will shortly create an issue with a proposal for restructuring the test suite a little bit. When we agree on what to do we can move the test(s) to appropriate locations.

@mgencur
Copy link
Contributor Author

mgencur commented Jul 25, 2019

@navidshaikh the failure doesn't seem to be related to my changes. Can you advise what to do, pls?

@rhuss
Copy link
Contributor

rhuss commented Jul 25, 2019

/retest

@rhuss
Copy link
Contributor

rhuss commented Jul 25, 2019

I'm not sure about that flake, because I thought it was fixed with #271 . It might be that we have to increase the timeout for the wait (as if there's a timeout, then the previous update command returns prematurely).

I just triggered a retest. Let's see how it goes ...

@mgencur
Copy link
Contributor Author

mgencur commented Jul 25, 2019

Passed this time:)

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 lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 25, 2019
@maximilien
Copy link
Contributor

@mgencur not quite...

Running 'kubectl delete namespace kne2etests0'...
--- FAIL: TestBasicWorkflow (126.82s)
    --- PASS: TestBasicWorkflow/returns_no_service_before_running_tests (0.05s)
    --- PASS: TestBasicWorkflow/create_hello_service_and_returns_no_error (24.58s)
    --- PASS: TestBasicWorkflow/create_hello_service_again_and_get_service_already_exists_error (0.12s)
    --- PASS: TestBasicWorkflow/returns_valid_info_about_hello_service (0.14s)
    --- PASS: TestBasicWorkflow/update_hello_service's_configuration_and_returns_no_error (0.11s)
    --- PASS: TestBasicWorkflow/create_another_service_and_returns_no_error (2.99s)
    --- FAIL: TestBasicWorkflow/returns_a_list_of_revisions_associated_with_hello_and_svc2_services (0.13s)
        basic_workflow_test.go:132: assertion failed: 
            Actual output: hello-kxgvk   hello     3s    1 OK / 5     Unknown   Deploying
            Missing strings: True
...

Might be flaky and timing to allow status to update.

out, err := test.kn.RunWithOpts([]string{"service", "describe", serviceName, "-o=name"}, runOpts{})
assert.NilError(t, err)

expectedName := fmt.Sprintf("service.serving.knative.dev/%s", serviceName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this error message needs to be fixed on kn side, I will have a PR for this fix.

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

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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:

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

@navidshaikh
Copy link
Collaborator

/test pull-knative-client-integration-tests-latest-release

@knative-prow-robot knative-prow-robot merged commit 03ecb36 into knative:master Jul 26, 2019
coryrc pushed a commit to coryrc/client that referenced this pull request May 14, 2020
* Fix image build in release

$KO_DOCKER_REPO must be exported.

Bonuses:
* make `publish_yaml` more verbose
* log the config before building, for easier debugging/investigation/auditing

* Update description of tag_images_in_yaml()
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants