Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added `JobListParams.TagsAll` and `JobListParams.TagsAny` for filtering jobs that match every or any exact tag, respectively. [PR #1339](https://github.com/riverqueue/river/pull/1339).

### Fixed

- `testsignal` no longer imports `riversharedtest`, so testify, go-spew, goleak, and yaml are no longer linked into production binaries that use River. `WaitTimeout` moved to `rivershared/util/testutil`, with `riversharedtest.WaitTimeout` kept as a wrapper around it. [PR #1342](https://github.com/riverqueue/river/pull/1342).

## [0.42.0] - 2026-07-31

### Added
Expand Down
9 changes: 4 additions & 5 deletions rivershared/riversharedtest/riversharedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,11 @@ func WaitOrTimeoutN[T any](tb testutil.TestingTB, waitChan <-chan T, numValues i
// extra leeway in GitHub Actions where we occasionally seem to observe subpar
// performance which leads to timeouts and test intermittency, while still
// keeping a tight a timeout for local test runs where this is never a problem.
//
// The implementation lives in testutil so that testsignal, which is compiled
// into production binaries, can use it without importing this package.
func WaitTimeout() time.Duration {
if os.Getenv("GITHUB_ACTIONS") == "true" {
return 10 * time.Second
}

return 3 * time.Second
return testutil.WaitTimeout()
}

var IgnoredKnownGoroutineLeaks = []goleak.Option{ //nolint:gochecknoglobals
Expand Down
3 changes: 1 addition & 2 deletions rivershared/testsignal/test_signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package testsignal
import (
"time"

"github.com/riverqueue/river/rivershared/riversharedtest"
"github.com/riverqueue/river/rivershared/util/testutil"
)

Expand Down Expand Up @@ -86,7 +85,7 @@ func (s *TestSignal[T]) WaitOrTimeout() T {
panic("test only signal is not initialized; called outside of tests?")
}

timeout := riversharedtest.WaitTimeout()
timeout := testutil.WaitTimeout()

select {
case val := <-s.internalChan:
Expand Down
11 changes: 0 additions & 11 deletions rivershared/testsignal/test_signal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package testsignal

import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/riverqueue/river/rivershared/riversharedtest"
"github.com/riverqueue/river/rivershared/util/testutil"
)

Expand Down Expand Up @@ -107,12 +105,3 @@ func TestTestSignal(t *testing.T) {
signal.WaitOrTimeout()
})
}

// Marked as non-parallel because `t.Setenv` is not compatible with `t.Parallel`.
func TestWaitTimeout(t *testing.T) {
t.Setenv("GITHUB_ACTIONS", "")
require.Equal(t, 3*time.Second, riversharedtest.WaitTimeout())

t.Setenv("GITHUB_ACTIONS", "true")
require.Equal(t, 10*time.Second, riversharedtest.WaitTimeout())
}
20 changes: 20 additions & 0 deletions rivershared/util/testutil/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"time"
)

// See docs on PanicTB.
Expand Down Expand Up @@ -119,3 +120,22 @@ type TestingTB interface {
Logf(format string, args ...any)
Name() string
}

// WaitTimeout returns a duration broadly appropriate for waiting on an expected
// event in a test, and which is used for `TestSignal.WaitOrTimeout` in
// testsignal and `WaitOrTimeout` in riversharedtest. Its main purpose is to
// allow a little extra leeway in GitHub Actions where we occasionally seem to
// observe subpar performance which leads to timeouts and test intermittency,
// while still keeping a tight a timeout for local test runs where this is never
// a problem.
//
// It lives here instead of riversharedtest so that testsignal, which is
// compiled into production binaries, can use it without importing
// riversharedtest and its heavier test-only dependencies.
func WaitTimeout() time.Duration {
if os.Getenv("GITHUB_ACTIONS") == "true" {
return 10 * time.Second
}

return 3 * time.Second
}
16 changes: 16 additions & 0 deletions rivershared/util/testutil/test_util_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
package testutil

import (
"testing"
"time"

"github.com/stretchr/testify/require"
)

var _ TestingTB = &panicTB{}

// Marked as non-parallel because `t.Setenv` is not compatible with `t.Parallel`.
func TestWaitTimeout(t *testing.T) {
t.Setenv("GITHUB_ACTIONS", "")
require.Equal(t, 3*time.Second, WaitTimeout())

t.Setenv("GITHUB_ACTIONS", "true")
require.Equal(t, 10*time.Second, WaitTimeout())
}
Loading