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

WIP: testify version of fluent_conf_test.go for review #355

Closed

Conversation

alanconway
Copy link
Contributor

For comparison with Ginkgo tests, review & discussion only. Do not commit.

Signed-off-by: Alan Conway aconway@redhat.com

For comparison with Ginkgo tests, review & discussion only.
Do not commit.

Signed-off-by: Alan Conway <aconway@redhat.com>
@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 4, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alanconway

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 4, 2020
@jcantrill
Copy link
Contributor

I realize this is possible given what you expressed in the email thread but I would propose you have reverted the all the advantages of what I see to Ginko: intent and expressiveness. This version of the test requires a developer to mentally understand the test from top to bottom and interpret the intent of the test from the terse name. 👎

This version follows the original more closely: sub-tests in a single test
function, same scope for common setup and variables, same (almost) test
names. t.Run() prints "TestXXX/does whatever" vs. Ginkgo's "XXX it does whatever""

When you have the same test run on multiple inputs it's common to write a "table
driven test" where you write the logic once and have a list of input and
expected output for each case - it's more concise when you have a lot of
cases.

See https://dave.cheney.net/2019/05/07/prefer-table-driven-tests - skip to the
last example as he builds it up from more basic Go features before he finally
shows using testing.T.Run().

Signed-off-by: Alan Conway <aconway@redhat.com>
@alanconway
Copy link
Contributor Author

Pushed an update that has the same detailed test names and variable/function scopes as your example.

@openshift-ci-robot
Copy link

@alanconway: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/unit 7680dda link /test unit

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@jcantrill
Copy link
Contributor

Closing as I expect this is simply to prove out alternate test options

@jcantrill jcantrill closed this Feb 14, 2020
@alanconway alanconway deleted the fluent-conf-test-testify branch May 1, 2020 12:48
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

3 participants