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

Add timeout configuration support #262

Merged
merged 1 commit into from
Mar 25, 2025
Merged

Add timeout configuration support #262

merged 1 commit into from
Mar 25, 2025

Conversation

teddyknox
Copy link
Contributor

Description

Adds the ability to configure the timeout of an individual test or test package, and also adds the ability to update the default test timeout for an op-acceptor startup invocation via CLI.

Tests

I've tested the command building.

Additional context

Add any other context about the problem you're solving.

Metadata

@teddyknox teddyknox added the A-acceptance-testing Area: Acceptance Testing label Mar 24, 2025
@teddyknox teddyknox requested a review from scharissis March 24, 2025 15:10
@teddyknox teddyknox requested a review from a team as a code owner March 24, 2025 15:10
@@ -20,6 +20,7 @@ type Config struct {
RunInterval time.Duration // Interval between test runs
RunOnce bool // Indicates if the service should exit after one test run
AllowSkips bool // Allow tests to be skipped instead of failing when preconditions are not met
DefaultTimeout time.Duration // Default timeout for individual tests, can be overriden by test config
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiniest of things - why not just Timeout?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just adding my opinion to this: if we can override it per-test/suite/gate then I like having 'Default' in the name. Because if you ran it with op-acceptor --timeout 5m and then a test timed out after 1m (because it has an override), that'd be confusing. Whereas if it were labelled --default-timeout then that would explain things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@scharissis explained well

@@ -53,6 +54,12 @@ var (
EnvVars: opservice.PrefixEnvVar(EnvVarPrefix, "ALLOW_SKIPS"),
Usage: "Allow tests to be skipped instead of failing when preconditions are not met.",
}
DefaultTimeout = &cli.DurationFlag{
Copy link
Contributor

Choose a reason for hiding this comment

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

The same from above - the sorta standard across all frameworks is --timeout, i'd just name it that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@scharissis covered well my thoughts #262 (comment)

Copy link
Contributor

@scharissis scharissis left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

A few notes/questions:

  1. How would one override the timeout of an individual test?
  2. Can you please add some tests showing this all works?
  3. CI is failing due to lint errors. (To check them locally run golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...)

@teddyknox teddyknox force-pushed the op-acceptor-timeout branch from 03e5642 to f369dd4 Compare March 25, 2025 02:29
@teddyknox teddyknox force-pushed the op-acceptor-timeout branch from f369dd4 to 5f285a1 Compare March 25, 2025 02:32
@teddyknox teddyknox requested a review from scharissis March 25, 2025 02:32
@teddyknox
Copy link
Contributor Author

Thanks for your comments @scharissis, re-requesting!

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 75.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 53.76%. Comparing base (b11f9ea) to head (5f285a1).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
op-acceptor/config.go 0.00% 3 Missing ⚠️
op-acceptor/registry/registry.go 66.66% 1 Missing and 2 partials ⚠️
op-acceptor/nat.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #262      +/-   ##
==========================================
+ Coverage   53.60%   53.76%   +0.16%     
==========================================
  Files          67       67              
  Lines        7886     7923      +37     
==========================================
+ Hits         4227     4260      +33     
- Misses       3378     3381       +3     
- Partials      281      282       +1     
Flag Coverage Δ
op-acceptor 55.48% <75.00%> (+0.78%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
op-acceptor/flags/flags.go 57.14% <ø> (ø)
op-acceptor/runner/runner.go 70.30% <100.00%> (+1.56%) ⬆️
op-acceptor/types/test.go 0.00% <ø> (ø)
op-acceptor/types/validator.go 20.00% <ø> (ø)
op-acceptor/nat.go 40.67% <0.00%> (-0.35%) ⬇️
op-acceptor/config.go 0.00% <0.00%> (ø)
op-acceptor/registry/registry.go 77.63% <66.66%> (-0.85%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@scharissis scharissis merged commit d6d181a into main Mar 25, 2025
6 checks passed
@scharissis scharissis deleted the op-acceptor-timeout branch March 25, 2025 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-acceptance-testing Area: Acceptance Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add configurable timeout support to op-acceptor
4 participants