-
Notifications
You must be signed in to change notification settings - Fork 266
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
Conversation
* service, revision, route describe and describe with print flags * route list with print flags * service create for a duplicate service
There was a problem hiding this 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.
test/e2e/basic_workflow_test.go
Outdated
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.
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
test/e2e/basic_workflow_test.go
Outdated
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.
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)
There was a problem hiding this comment.
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
test/e2e/basic_workflow_test.go
Outdated
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.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
test/e2e/revision_workflow_test.go
Outdated
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.
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
/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:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
[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 |
/test pull-knative-client-integration-tests-latest-release |
* 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()
Fixes #
Proposed Changes
Release Note