agent-substrate / agent-substrate/substrate

Unit test race: cmd/ateapi/internal/controlapi

Open
#1,230 2 comments 0 reactions 0 assignees View on GitHub
area/tests kind/bug prio/P0
Dominant language
Go
Stars
1.8k
Forks
316
Avg merge
2d 43m
Merged PRs (30d)
287

Description

### Agent reported `go test -race` failure

Transient Failure: Testcontainer Database Connection Drop under Load

Failing Package: github.com/agent-substrate/substrate/cmd/ateapi/internal/controlapi

### Symptoms

```
storetest.go:74: dropping PostgreSQL test database: conn closed
workflow_suspend_test.go:211: creating PostgreSQL test database: failed to connect to `user=postgres database=postgres`:

127.0.0.1:32781 (localhost): failed to receive message: read tcp 127.0.0.1:...->127.0.0.1:32781: read:
connection reset by peer
```

### Potential Root Cause (need verification)

When go test -race ./... executes every package concurrently, multiple packages spin up Docker PostgreSQL containers and create/drop dozens of databases in parallel via storetest.go:51-78.

Under the high CPU/memory overhead of the race detector, the Docker container port/connection dropped mid-suite, causing subsequent subtests to fail with connection reset / refused errors.

When tested individually (go test -race ./cmd/ateapi/...), all tests in controlapi pass cleanly with zero race warnings.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.