Skip to content

Commit 0b01ff8

Browse files
authored
test: keep fixture setup outside watch deadlines (#1287)
Windows CI could intermittently fail the push-watch lifecycle test before the local PostgreSQL watch owner began. The one-second coordination deadline also covered local SQLite creation and migrations, so runner load could be misclassified as a watch failure. Prepare the local owner fixtures before launching the timed goroutines. This keeps the deadline strict for the coordination behavior under test while excluding unrelated fixture setup; production watch behavior is unchanged. Co-authored-by: Wes McKinney <wesm@users.noreply.github.com>
1 parent e9703c2 commit 0b01ff8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

cmd/agentsview/archive_write_backend_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ type pushWatchOwnerCase struct {
333333

334334
func pushWatchOwnerCases(t *testing.T) []pushWatchOwnerCase {
335335
t.Helper()
336+
// Keep SQLite setup outside the timed owner goroutines so channel deadlines
337+
// measure watch coordination rather than fixture creation on slow runners.
338+
localDuckDB := testLocalArchiveWriteBackend(t)
339+
localPostgreSQL := testLocalArchiveWriteBackend(t)
336340
return []pushWatchOwnerCase{
337341
{
338342
name: "daemon DuckDB",
@@ -355,9 +359,8 @@ func pushWatchOwnerCases(t *testing.T) []pushWatchOwnerCase {
355359
{
356360
name: "local DuckDB",
357361
run: func(ctx context.Context, hooks *archivePushWatchHooks) error {
358-
backend := testLocalArchiveWriteBackend(t)
359-
backend.watchHooks = hooks
360-
return backend.DuckDBPushWatch(
362+
localDuckDB.watchHooks = hooks
363+
return localDuckDB.DuckDBPushWatch(
361364
ctx, config.DuckDBConfig{}, DuckDBPushConfig{}, nil, nil,
362365
time.Hour, time.Hour,
363366
)
@@ -366,9 +369,8 @@ func pushWatchOwnerCases(t *testing.T) []pushWatchOwnerCase {
366369
{
367370
name: "local PostgreSQL",
368371
run: func(ctx context.Context, hooks *archivePushWatchHooks) error {
369-
backend := testLocalArchiveWriteBackend(t)
370-
backend.watchHooks = hooks
371-
return backend.PGPushWatch(
372+
localPostgreSQL.watchHooks = hooks
373+
return localPostgreSQL.PGPushWatch(
372374
ctx, pgTargetSelection{}, PGPushConfig{}, nil, nil,
373375
time.Hour, time.Hour,
374376
)

0 commit comments

Comments
 (0)