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

Replace assert with require in e2e channel defaults webhook test #4739

Closed
3 tasks
xtreme-sameer-vohra opened this issue Jan 14, 2021 · 8 comments · Fixed by #4790
Closed
3 tasks

Replace assert with require in e2e channel defaults webhook test #4739

xtreme-sameer-vohra opened this issue Jan 14, 2021 · 8 comments · Fixed by #4790
Assignees
Labels
area/test-and-release Test infrastructure, tests or release kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/good-first-issue Denotes an issue ready for a new contributor. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Milestone

Comments

@xtreme-sameer-vohra
Copy link
Contributor

xtreme-sameer-vohra commented Jan 14, 2021

Problem
use "require.Nil" instead of "assert.Equal" for test setup. The latter
notes a failure but doesn't fail immediately. This resulted in panics
in subsequent sections of the test and made it hard to pin point the
reason. "require.Nil" will output the error and fail immediately
making it easier to debug issues with test setup.

Channel Defaults Webhook Test
Specifically, at least these locations (there might be others uses of assert.Nil that fall under test setup rather than test assertion and therefore should use require.Nil)

Persona:
Which persona is this feature for?
Contributor

Additional context (optional)
Original Issue & PR for similar broker test: #4717, #4720

@xtreme-sameer-vohra
Copy link
Contributor Author

I'd appreciate some feedback regarding:
This can be a good first issue or the scope could be expanded to audit other e2e tests so that the usage is more clearer and consistent across the suite.

@zhongduo
Copy link
Contributor

I think "not failing immediately" might be useful in unit tests due to table testing. But I cannot think of any reason for e2e test, so I would vote for failing early.

@xtreme-sameer-vohra
Copy link
Contributor Author

Thanks and is it better do have an issue/test or issue/e2e suite? The former makes it more suitable for folks getting started and doable in tiny quick chunks but adds overhead of many issues/prs 🤷

@zhongduo
Copy link
Contributor

zhongduo commented Jan 14, 2021 via email

@xtreme-sameer-vohra
Copy link
Contributor Author

Sorry, I wasn't clear. What I was trying to get some guidance on was for a cross cutting change like this is it better to

  • have one issue per test file eg. channel_defaults_webhook_test.go and then the PR can close it out
  • have one issue for the entire suite e2e suite

Option 1 makes it good for new contributors as the changes are minor but there is the extra overhead of many issues & PRs to span the suite
Option 2 makes it harder for new contributors but there is less overhead as 1 issue & PR solve the problem

For now, I'll assume having an issue per test file is the way to go.

@zhongduo
Copy link
Contributor

zhongduo commented Jan 14, 2021 via email

@lberk lberk added the area/test-and-release Test infrastructure, tests or release label Jan 25, 2021
@lberk
Copy link
Member

lberk commented Jan 25, 2021

@xtreme-sameer-vohra it might be worth adding a checklist of all the places we need to make this replacement to this issue, and check them off as they're fixed. Thanks!

@lberk lberk added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/good-first-issue Denotes an issue ready for a new contributor. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed kind/feature-request labels Jan 25, 2021
@lberk lberk added this to the Backlog milestone Jan 25, 2021
@xtreme-sameer-vohra
Copy link
Contributor Author

@xtreme-sameer-vohra it might be worth adding a checklist of all the places we need to make this replacement to this issue, and check them off as they're fixed. Thanks!

done. Since this hasn't been picked up yet, I'll take it.

/assign

xtreme-sameer-vohra added a commit to xtreme-sameer-vohra/eventing that referenced this issue Jan 26, 2021
- use "require.Nil" instead of "assert.Equal" for test setup and where
  we don't wish to retry. The latter notes a failure but doesn't fail
  immediately. This resulted in panics in subsequent sections of the
  broker defaults webhook test [knative#4717] and made it hard to pin point
  the reason. "require.Nil" will output the error and fail immediately
  making it easier to debug issues with test setup.

Signed-off-by: Sameer Vohra <vsameer@vmware.com>
knative-prow-robot pushed a commit that referenced this issue Jan 26, 2021
- use "require.Nil" instead of "assert.Equal" for test setup and where
  we don't wish to retry. The latter notes a failure but doesn't fail
  immediately. This resulted in panics in subsequent sections of the
  broker defaults webhook test [#4717] and made it hard to pin point
  the reason. "require.Nil" will output the error and fail immediately
  making it easier to debug issues with test setup.

Signed-off-by: Sameer Vohra <vsameer@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test-and-release Test infrastructure, tests or release kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/good-first-issue Denotes an issue ready for a new contributor. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants