Files
substrate/cmd/ateapi/internal/controlapi/main_test.go
T
Benjamin Elder 14ba2c9c07 storetest: terminate the shared PostgreSQL container, respect docker context (#1297)
I noticed my machine filling up with postgres containers ...

---

First:

storetest starts one PostgreSQL container per test binary in a sync.Once
and never stops it, so every package that uses it leaks a container per
run. Testcontainers' Ryuk reaper normally covers this, but it is not
guaranteed to be running, and nothing else stops the container.

Add Shutdown, plus a RunTests wrapper for packages whose TestMain does
nothing else, and call it from the three packages that use storetest.
atepg already terminates its own container this way.

----

Second:

testcontainers does not respect docker contexts, making it difficult to
use with [limactl](https://lima-vm.io/) etc.

See: https://github.com/testcontainers/testcontainers-go/issues/2607 

We automate the workaround to set the host env to point at the socket
from the active docker context.
2026-08-28 17:05:20 -07:00

26 lines
763 B
Go

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package controlapi
import (
"testing"
"github.com/agent-substrate/substrate/cmd/ateapi/internal/store/storetest"
)
func TestMain(m *testing.M) {
storetest.RunTests(m)
}