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

Exit test after timeout #7118

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stephanos
Copy link
Contributor

@stephanos stephanos commented Jan 18, 2025

What changed?

Added per-test timeouts.

Unfortunately there's no way to stop a particular Goroutine from the outside. That's why os.Exit - the nuclear option - is really the only choice IMO.

Why?

Go only allows to set a timeout on the entire test run. But sometimes a single test is stuck and never going to complete. But you still have to wait for the very long timeout.

With this, at least it will fail fast.

How did you test it?

Potential risks

It could prematurely abort slower (non-stuck) tests - and require more tweaking of the timeouts for these. That could be annoying.

Documentation

Is hotfix candidate?

@stephanos stephanos force-pushed the test-suite-timeout branch 13 times, most recently from 27b09d5 to 8a83088 Compare January 18, 2025 00:53
Comment on lines +34 to +70
rawStack := append(debug.Stack(), '\n', '\n')
_, _, err := stack.ScanSnapshot(bytes.NewReader(rawStack), os.Stdout, stack.DefaultOpts())
if err != nil {
t.Logf("failed to parse stack trace: %v", err)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This output is a bit more readable than Go's default output.

Comment on lines +271 to +274
- name: Highlight test timeout
if: ${{ steps.test_run.outcome == 'failure' && steps.test_run.outputs.exit_code == 124 }}
run: |
echo "::error::Test Test timed out"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example:
TODO

@stephanos stephanos force-pushed the test-suite-timeout branch 4 times, most recently from 87fa3f8 to d6696c9 Compare January 18, 2025 01:38
@stephanos stephanos changed the title Exit suite or test after timeout Exit test after timeout Jan 18, 2025
@@ -244,10 +247,21 @@ func (s *FunctionalTestBase) SetupSuiteWithCluster(clusterConfigFile string, opt
func (s *FunctionalTestBase) SetupTest() {
s.checkTestShard()
s.initAssertions()
if s.testTimeout == nil {
s.testTimeout = newTestTimeout(s.T(), 30*time.Second*debug.TimeoutMultiplier)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't be in SetupSuite as the SDK functional test suite overrides that.

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.

1 participant