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

testutils: capture Side-Eye snapshots in SucceedsSoon #136839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asg0451
Copy link
Contributor

@asg0451 asg0451 commented Dec 5, 2024

Make testutils.SucceedsSoon() capture a snapshot of the test process
with Side-Eye when the deadline expires. The idea is to help with
debugging flaky unit tests, both locally and on CI: the snapshot should
help us figure out where the operation that the test was waiting on has
gotten stuck.

The snapshot is generated if the SIDE_EYE_TOKEN environment variable is
set (it should be set to our organization's API token). The test log will
have a link to app.side-eye.io for visualizing the collected snapshot.

In the future, perhaps we can use Side-Eye to also collect execution
traces and CPU profiles for even more information.

Epic: None
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@asg0451 asg0451 marked this pull request as ready for review December 5, 2024 18:55
@asg0451 asg0451 requested a review from a team as a code owner December 5, 2024 18:55
@asg0451
Copy link
Contributor Author

asg0451 commented Dec 5, 2024

thought: maybe it would be better if this was opt-in for tests

@stevendanna
Copy link
Collaborator

thought: maybe it would be better if this was opt-in for tests

I wonder if perhaps the place to put this is into some function that you can defer. It could look at (*testing.T).Failed() and then capture the snapshot if the environment variable is set and if the test failed. This would make it easy to drop this into a test that uses other means of waiting for things as well. The tricky bit would be that you would want to make sure you always placed the defer after any defered stopper Stops.

Out of curiosity, would it be possible to take the snapshot but save it to disk rather than send it to side-eye directly? Then perhaps side-eye could allow us to upload the snapshot if we end up actually caring about it?

@asg0451 asg0451 force-pushed the sideeye-succeedssoon-2 branch 2 times, most recently from 7027966 to 478bbe4 Compare December 9, 2024 20:22
@asg0451 asg0451 requested a review from a team as a code owner December 9, 2024 20:22
@asg0451 asg0451 requested review from golgeek, sambhav-jain-16 and rickystewart and removed request for a team December 9, 2024 20:22
@asg0451 asg0451 force-pushed the sideeye-succeedssoon-2 branch 3 times, most recently from 293a51b to d960700 Compare December 16, 2024 18:42
Make testutils.SucceedsSoon() capture a snapshot of the test process
with Side-Eye when the deadline expires. The idea is to help with
debugging flaky unit tests, both locally and on CI: the snapshot should
help us figure out where the operation that the test was waiting on has
gotten stuck.

The snapshot is generated if the SIDE_EYE_API_TOKEN environment variable is
set (it should be set to our organization's API token). The test log will
have a link to app.side-eye.io for visualizing the collected snapshot.

In the future, perhaps we can use Side-Eye to also collect execution
traces and CPU profiles for even more information.

Epic: None
Release note: None
@asg0451 asg0451 force-pushed the sideeye-succeedssoon-2 branch from d960700 to 0102e7a Compare December 16, 2024 18:59
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.

4 participants