docs: reorder & testing
This commit is contained in:
@@ -11,12 +11,19 @@ import (
|
||||
// StartNetwork creates a user-defined Docker bridge network and
|
||||
// registers a t.Cleanup to remove it. All platform containers attach
|
||||
// to the same network so they can resolve each other by alias.
|
||||
//
|
||||
// A failure here is fatal, not a skip: the network create path runs
|
||||
// long after `RequireDocker` has confirmed the daemon is reachable, so
|
||||
// any error here is a real environment break (subnet exhaustion, a
|
||||
// half-dead Ryuk reaper, a daemon-side network plugin issue) and
|
||||
// silently skipping it would mask the rest of the suite as
|
||||
// "passing" when nothing in fact ran.
|
||||
func StartNetwork(t *testing.T) *testcontainers.DockerNetwork {
|
||||
t.Helper()
|
||||
ctx := context.Background()
|
||||
net, err := tcnetwork.New(ctx)
|
||||
if err != nil {
|
||||
t.Skipf("docker network unavailable: %v", err)
|
||||
t.Fatalf("create docker network: %v", err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
if err := net.Remove(ctx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user