PID%1000 collided with a concurrent job on the shared CI host (run on
e946709: process already listening on port 54000). freePort asks the OS;
Start is retried up to 3 times if the port is taken in between.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZkhi49hfeSqBp5aZJNXsM
20 lines
646 B
Go
20 lines
646 B
Go
package store_test
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestMain's Postgres already holds a port. A second instance started in the
|
|
// same process must still come up, i.e. the port is not derived from something
|
|
// two starters share (the PID). Observes: startTestPostgres succeeds while
|
|
// another instance from this process is listening.
|
|
func TestStartTestPostgres_SecondInstanceStartsWhileFirstHoldsItsPort(t *testing.T) {
|
|
pg, _, rt, err := startTestPostgres(fmt.Sprintf("tapir-epg-store-second-%d", os.Getpid()))
|
|
require.NoError(t, err)
|
|
t.Cleanup(func() { _ = pg.Stop(); _ = os.RemoveAll(rt) })
|
|
}
|