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

Clean up e2e test assertion #264

Merged
merged 3 commits into from
Jul 15, 2019

Conversation

toVersus
Copy link
Contributor

This is a follow-up PR of #256 . We should use assert package (and utils) for testing the output string to keep consistency between unit and e2e tests.

Heavily rely on assert package as well as unit tests
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 13, 2019
@knative-prow-robot
Copy link
Contributor

Hi @toVersus. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 13, 2019
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.

Thanks ! Looks good with one comment below.

The other thing which might be super useful is (now that you removed many error messages when an error is returned, which makes the code easier to read):

In the single main test method, can we wrap the calls to the subtests into t.Run("description of subtest", func(t *testing.T) { .... }) kind of subtest calls. This would make it much easier to spot the error location in case of an error.

Check e.g. client_test.go for how such subtest can be structured.

test/e2e/basic_workflow_test.go Outdated Show resolved Hide resolved
@rhuss
Copy link
Contributor

rhuss commented Jul 13, 2019

/okt-to-test

@toVersus
Copy link
Contributor Author

toVersus commented Jul 13, 2019

In the single main test method, can we wrap the calls to the subtests into t.Run("description of subtest", func(t *testing.T) { .... }) kind of subtest calls.

@rhuss Can I make sure your intention here? Just wrap the subtests in the single main test method (e.g. TestBasicWorkflow) at this level of granularity?

func TestBasicWorkflow(t *testing.T) {
	teardown := Setup(t)
	defer teardown(t)

	t.Run("returns no service before running tests", func(t *testing.T) {
		testServiceListEmpty(t, k)
	})

	t.Run("create hello service and returns no error", func(t *testing.T) {
		testServiceCreate(t, k, "hello")
	}

	t.Run("returns rough and detailed information about hello service")
		testServiceList(t, k, "hello")
		testServiceDescribe(t, k, "hello")
	})
...
}

@toVersus
Copy link
Contributor Author

@rhuss Thanks for reviewing! I tried to add subtests in main test methods. Let me know if you have any opinions about the level of granularity. BTW, Prow doesn't trigger the test due to a typo 😼

@mattmoor mattmoor removed their request for review July 13, 2019 16:44
@rhuss
Copy link
Contributor

rhuss commented Jul 15, 2019

/ok-to-test

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 15, 2019
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.

Thanks !

/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 15, 2019
@navidshaikh
Copy link
Collaborator

/test pull-knative-client-integration-tests

@navidshaikh
Copy link
Collaborator

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

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.

Thanks!

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh, rhuss, toVersus

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

@knative-prow-robot knative-prow-robot merged commit fca0a09 into knative:master Jul 15, 2019
dsimansk added a commit to dsimansk/client that referenced this pull request Oct 12, 2023
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.

5 participants