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

roachtest: remove all panics from perturbation/* tests #130866

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

andrewbaptist
Copy link
Collaborator

Panics in the test cause the entire roachtest to stop. Instead we should call t.Fatal or similar methods. This commit passes test.Test to most methods and removes all panics from the perturbation tests.

Epic: none

Release note: None

@andrewbaptist andrewbaptist requested a review from a team as a code owner September 17, 2024 14:15
@andrewbaptist andrewbaptist requested review from nameisbhaskar and renatolabs and removed request for a team September 17, 2024 14:15
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@andrewbaptist
Copy link
Collaborator Author

@renatolabs I removed all the panics from the perturbation tests. Thanks for the pointer that this was necessary!

Copy link
Contributor

@renatolabs renatolabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are fine to me but, for the record, the panics removed here would not cause the test suite to crash. The issue is not that panics cause tests to fail but instead that panics in "bare" go functions do (unless you always remember to call recover). This is because we can't recover from panics from a different goroutine. This is a more general point about Go programs1 rather than something to do with roachtest. See also #58164.

The panic removed in #130803 was only a problem because it happened in one such bare go call. Calling panic in the main test Run function or in a monitor.Go() function are both fine (t.Fatal and require are implemented as panics anyway).

Footnotes

  1. https://go.dev/wiki/PanicAndRecover

Panics in the test cause the entire roachtest to stop. Instead we should
call t.Fatal or similar methods. This commit passes test.Test to most
methods and removes all panics from the perturbation tests.

Epic: none

Release note: None
@andrewbaptist
Copy link
Collaborator Author

TFTR!

Its probably still best to remove the panics, then if something moves into/out of a bare goroutine it won't cause problems.

bors r=renatolabs

@craig craig bot merged commit 29ad4d3 into cockroachdb:master Sep 17, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants