aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/helper_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-16 02:34:06 +0900
committerOphestra <cat@gensokyo.uk>2025-03-16 02:49:41 +0900
commit1576fea8a33a165562deff6b0d8adda35ad62244 (patch)
tree6c6b16176e1dd54f43330051f484adf381152ede /helper/helper_test.go
parentae522ab36473ab91f12af3b9d0ee0afced61c02c (diff)
helper: raise WaitDelay during tests
Helper runs very slowly with race detector. This prevents it from timing out. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'helper/helper_test.go')
-rw-r--r--helper/helper_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/helper/helper_test.go b/helper/helper_test.go
index 27c31719..ced3bb8b 100644
--- a/helper/helper_test.go
+++ b/helper/helper_test.go
@@ -48,10 +48,11 @@ func argFChecked(argsFd, statFd int) (args []string) {
}
// this function tests an implementation of the helper.Helper interface
-func testHelper(t *testing.T,
- createHelper func(ctx context.Context, setOutput func(stdoutP, stderrP *io.Writer), stat bool) helper.Helper,
- prefix string,
-) {
+func testHelper(t *testing.T, createHelper func(ctx context.Context, setOutput func(stdoutP, stderrP *io.Writer), stat bool) helper.Helper) {
+ oldWaitDelay := helper.WaitDelay
+ helper.WaitDelay = 16 * time.Second
+ t.Cleanup(func() { helper.WaitDelay = oldWaitDelay })
+
t.Run("start helper with status channel and wait", func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
stdout, stderr := new(strings.Builder), new(strings.Builder)
@@ -77,7 +78,7 @@ func testHelper(t *testing.T,
cancel()
t.Run("start already started helper", func(t *testing.T) {
- wantErr := prefix + ": already started"
+ wantErr := "helper: already started"
if err := h.Start(); err != nil && err.Error() != wantErr {
t.Errorf("Start: error = %v, wantErr %v",
err, wantErr)