Skip to content

Commit 0a23da1

Browse files
lpcoxCopilot
andcommitted
Derive default timeout expectations from config constant
Address review feedback: use config.DefaultStartupTimeout to compute expected timeout strings instead of hardcoding '30s', preventing future drift between tests and the actual default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6aca689 commit 0a23da1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

internal/launcher/launcher_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http/httptest"
99
"os"
1010
"testing"
11+
"time"
1112

1213
"github.com/stretchr/testify/assert"
1314
"github.com/stretchr/testify/require"
@@ -552,16 +553,18 @@ func TestGetOrLaunchForSession_InvalidServer(t *testing.T) {
552553
}
553554

554555
func TestLauncher_StartupTimeout(t *testing.T) {
556+
defaultTimeout := (time.Duration(config.DefaultStartupTimeout) * time.Second).String()
557+
555558
// Test that launcher respects the startup timeout from config
556559
tests := []struct {
557560
name string
558561
configTimeout int
559562
expectedTimeout string
560563
}{
561564
{
562-
name: "default timeout (30 seconds)",
565+
name: "default timeout",
563566
configTimeout: 0, // 0 means use default
564-
expectedTimeout: "30s",
567+
expectedTimeout: defaultTimeout,
565568
},
566569
{
567570
name: "custom timeout (30 seconds)",
@@ -623,8 +626,9 @@ func TestLauncher_TimeoutWithNilGateway(t *testing.T) {
623626
l := New(ctx, cfg)
624627
defer l.Close()
625628

626-
// Should use default timeout (30 seconds)
627-
assert.Equal(t, "30s", l.startupTimeout.String())
629+
// Should use default timeout
630+
expectedDefault := (time.Duration(config.DefaultStartupTimeout) * time.Second).String()
631+
assert.Equal(t, expectedDefault, l.startupTimeout.String())
628632
}
629633

630634
func TestLauncher_OIDCProviderInitialization(t *testing.T) {

0 commit comments

Comments
 (0)