diff --git a/Makefile b/Makefile index a1489df7b..547ca2bf7 100644 --- a/Makefile +++ b/Makefile @@ -85,15 +85,15 @@ clean: rm -f msgvault msgvault.exe mimeshootout rm -rf bin/ -# Run tests. The 20m timeout matches CI's sharded jobs: heavy DuckDB -# packages (cmd, api, query) run concurrently on 2-core CI runners, and the -# per-package wall clock can exceed go test's 10m default under contention. +# Run tests. The CLI package has nearly 1,000 tests, including heavy DuckDB +# coverage, and its per-package wall clock can exceed 20m on contended CI +# runners even when no individual test is stalled. test: - go test -timeout 20m -tags "$(BUILD_TAGS)" ./... + go test -timeout 30m -tags "$(BUILD_TAGS)" ./... # Run tests with verbose output test-v: - go test -timeout 20m -tags "$(BUILD_TAGS)" -v ./... + go test -timeout 30m -tags "$(BUILD_TAGS)" -v ./... # Run tests against PostgreSQL with the pgvector tag (set MSGVAULT_TEST_DB # first). Needs a server with the vector extension available. diff --git a/cmd/msgvault/cmd/serve_test.go b/cmd/msgvault/cmd/serve_test.go index a07499463..4492a7e12 100644 --- a/cmd/msgvault/cmd/serve_test.go +++ b/cmd/msgvault/cmd/serve_test.go @@ -32,6 +32,8 @@ import ( "go.kenn.io/msgvault/internal/testutil/storetest" ) +const serveLifecycleTestTimeout = 30 * time.Second + func TestServeConfigParsing(t *testing.T) { require := require.New(t) assert := assert.New(t) @@ -203,7 +205,7 @@ func TestRunServeImmediateCancellationWaitsForAPIStart(t *testing.T) { select { case <-started: - case <-time.After(5 * time.Second): + case <-time.After(serveLifecycleTestTimeout): require.FailNow("API startup seam was not entered") } cancel() @@ -307,7 +309,7 @@ func TestRunServeServesHealthWhileAnalyticsBuildBlocked(t *testing.T) { case <-buildStarted: case err := <-errCh: require.NoError(err, "runServe exited before analytics build was blocked") - case <-time.After(5 * time.Second): + case <-time.After(serveLifecycleTestTimeout): require.FailNow("analytics cache build did not start") } waitForServeHealthBounded(t, c.Server.APIPort, errCh) @@ -374,7 +376,7 @@ func TestRunServeDuckDBReportsInitializingWithoutSQLFallback(t *testing.T) { case <-buildStarted: case err := <-errCh: require.NoError(err, "runServe exited before analytics build was blocked") - case <-time.After(5 * time.Second): + case <-time.After(serveLifecycleTestTimeout): require.FailNow("analytics cache build did not start") } waitForServeHealthBounded(t, c.Server.APIPort, errCh) @@ -467,7 +469,7 @@ func TestRunServeAutoSwitchesToDuckDBAfterBackgroundBuild(t *testing.T) { case <-buildStarted: case err := <-errCh: require.NoError(err, "runServe exited before analytics build was blocked") - case <-time.After(5 * time.Second): + case <-time.After(serveLifecycleTestTimeout): require.FailNow("analytics cache build did not start") } waitForServeHealthBounded(t, c.Server.APIPort, errCh) @@ -610,7 +612,7 @@ func freeTCPPort(t *testing.T) int { func waitForServeHealth(t *testing.T, port int, errCh <-chan error) { t.Helper() url := fmt.Sprintf("http://127.0.0.1:%d/health", port) - deadline := time.Now().Add(5 * time.Second) + deadline := time.Now().Add(serveLifecycleTestTimeout) for time.Now().Before(deadline) { select { case err := <-errCh: @@ -634,7 +636,7 @@ func waitForServeHealthBounded(t *testing.T, port int, errCh <-chan error) { t.Helper() client := &http.Client{Timeout: 100 * time.Millisecond} url := fmt.Sprintf("http://127.0.0.1:%d/health", port) - deadline := time.Now().Add(5 * time.Second) + deadline := time.Now().Add(serveLifecycleTestTimeout) for time.Now().Before(deadline) { select { case err := <-errCh: diff --git a/cmd/msgvault/cmd/serve_vector_integration_test.go b/cmd/msgvault/cmd/serve_vector_integration_test.go index cde5f161c..71bca03af 100644 --- a/cmd/msgvault/cmd/serve_vector_integration_test.go +++ b/cmd/msgvault/cmd/serve_vector_integration_test.go @@ -129,7 +129,7 @@ func TestRunServeGivesAnalyticsInitializationGatePriorityOverVector(t *testing.T case <-analyticsStarted: case err := <-errCh: require.NoError(t, err, "runServe exited before analytics initialization") - case <-time.After(5 * time.Second): + case <-time.After(serveLifecycleTestTimeout): require.FailNow(t, "analytics initialization did not start") } waitForServeHealth(t, c.Server.APIPort, errCh) @@ -148,7 +148,7 @@ func TestRunServeGivesAnalyticsInitializationGatePriorityOverVector(t *testing.T case <-vectorStarted: case err := <-errCh: require.NoError(t, err, "runServe exited before vector initialization") - case <-time.After(5 * time.Second): + case <-time.After(serveLifecycleTestTimeout): require.FailNow(t, "vector initialization did not start after analytics released the gate") } cancel() diff --git a/nix/package.nix b/nix/package.nix index cf5392b7f..db79fe1a1 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -5,7 +5,7 @@ sqlite, }: let - version = "0.19.2"; + version = "0.19.3"; in buildGoModule { pname = "msgvault";