@@ -6,20 +6,21 @@ import (
66 "encoding/json"
77 "errors"
88 "fmt"
9- "github.com/davecgh/go-spew/spew"
10- "github.com/go-playground/validator/v10"
11- "github.com/pelletier/go-toml/v2"
12- "github.com/rs/zerolog"
13- "github.com/stretchr/testify/require"
14- "github.com/testcontainers/testcontainers-go"
15- "github.com/testcontainers/testcontainers-go/network"
169 "os"
1710 "path/filepath"
1811 "strings"
1912 "sync"
2013 "testing"
2114 "text/template"
2215 "time"
16+
17+ "github.com/davecgh/go-spew/spew"
18+ "github.com/go-playground/validator/v10"
19+ "github.com/pelletier/go-toml/v2"
20+ "github.com/rs/zerolog"
21+ "github.com/stretchr/testify/require"
22+ "github.com/testcontainers/testcontainers-go"
23+ "github.com/testcontainers/testcontainers-go/network"
2324)
2425
2526const (
@@ -142,19 +143,20 @@ func Load[X any](t *testing.T) (*X, error) {
142143 // return nil, fmt.Errorf("failed to connect AWSSecretsManager: %w", err)
143144 // }
144145 //}
145- err = DefaultNetwork (once )
146+ err = DefaultNetwork (t , once )
146147 require .NoError (t , err )
147148 return input , nil
148149}
149150
150- func DefaultNetwork (once * sync.Once ) error {
151+ func DefaultNetwork (t * testing. T , once * sync.Once ) error {
151152 var net * testcontainers.DockerNetwork
152153 var err error
153154 once .Do (func () {
154155 net , err = network .New (
155156 context .Background (),
156157 network .WithLabels (map [string ]string {"framework" : "ctf" }),
157158 )
159+ testcontainers .CleanupNetwork (t , net )
158160 DefaultNetworkName = net .Name
159161 })
160162 return err
0 commit comments