Add E2E tests for Service, Revision, Route#291
Add E2E tests for Service, Revision, Route#291knative-prow-robot merged 2 commits intoknative:masterfrom
Conversation
* service, revision, route describe and describe with print flags * route list with print flags * service create for a duplicate service
knative-prow-robot
left a comment
There was a problem hiding this comment.
@mgencur: 0 warnings.
Details
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.
| assert.Check(t, strings.Contains(out, serviceName), "The service does not exist yet") | ||
|
|
||
| _, err = test.kn.RunWithOpts([]string{"service", "create", | ||
| fmt.Sprintf("%s", serviceName), |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
this should be an exact string match IMO, i..e assert.Equal(t, out, expectedName)
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
same as above about exact name matching
| assert.Check(t, util.ContainsAll(out, serviceName)) | ||
| } | ||
|
|
||
| func (test *e2eTest) serviceCreateDuplicate(t *testing.T, serviceName string) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
same comment as above, just check for exact match
| }) | ||
|
|
||
| t.Run("create hello service again and get service already exists error", func(t *testing.T) { | ||
| test.serviceCreateDuplicate(t, "hello") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
|
/ok-to-test |
|
/retest |
|
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. |
|
@navidshaikh the failure doesn't seem to be related to my changes. Can you advise what to do, pls? |
|
/retest |
|
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 ... |
|
Passed this time:) |
|
@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) |
There was a problem hiding this comment.
this error message needs to be fixed on kn side, I will have a PR for this fix.
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test pull-knative-client-integration-tests-latest-release |
Fixes #
Proposed Changes
Release Note