diff --git a/framework/cmd/interactive.go b/framework/cmd/interactive.go index 0791d6435..b9d619576 100644 --- a/framework/cmd/interactive.go +++ b/framework/cmd/interactive.go @@ -30,7 +30,7 @@ func createComponentsFromForm(form *nodeSetForm) error { _ *simple_node_set.Output err error ) - if err := framework.DefaultNetwork(t, &sync.Once{}); err != nil { + if err := framework.DefaultNetwork(&sync.Once{}); err != nil { return err } switch form.Network { diff --git a/framework/components/clnode/clnode_test.go b/framework/components/clnode/clnode_test.go index ad5b44907..832dc55c3 100644 --- a/framework/components/clnode/clnode_test.go +++ b/framework/components/clnode/clnode_test.go @@ -49,7 +49,7 @@ func TestComponentDockerNodeWithSharedDB(t *testing.T) { } for _, tc := range testCases { - err := framework.DefaultNetwork(t, &sync.Once{}) + err := framework.DefaultNetwork(&sync.Once{}) require.NoError(t, err) t.Run(tc.name, func(t *testing.T) { @@ -84,7 +84,7 @@ func TestComponentDockerNodeWithDB(t *testing.T) { } for _, tc := range testCases { - err := framework.DefaultNetwork(t, &sync.Once{}) + err := framework.DefaultNetwork(&sync.Once{}) require.NoError(t, err) t.Run(tc.name, func(t *testing.T) { diff --git a/framework/components/jd/jd_test.go b/framework/components/jd/jd_test.go index 863a993d1..2f3848345 100644 --- a/framework/components/jd/jd_test.go +++ b/framework/components/jd/jd_test.go @@ -14,7 +14,7 @@ import ( // since JD is private this env var should be set locally and in CI // TODO: add ComponentDocker prefix to turn this on when we'll have access to ECRs func TestJD(t *testing.T) { - err := framework.DefaultNetwork(t, &sync.Once{}) + err := framework.DefaultNetwork(&sync.Once{}) require.NoError(t, err) _, err = jd.NewJD(&jd.Input{ Image: os.Getenv("CTF_JD_IMAGE"), diff --git a/framework/components/simple_node_set/nodeset_test.go b/framework/components/simple_node_set/nodeset_test.go index 6c069f2ec..5fc63e5c3 100644 --- a/framework/components/simple_node_set/nodeset_test.go +++ b/framework/components/simple_node_set/nodeset_test.go @@ -113,7 +113,7 @@ level = 'info' } for _, tc := range testCases { - err := framework.DefaultNetwork(t, &sync.Once{}) + err := framework.DefaultNetwork(&sync.Once{}) require.NoError(t, err) t.Run(tc.name, func(t *testing.T) { diff --git a/framework/config.go b/framework/config.go index 83c7fa5c4..625e322b8 100644 --- a/framework/config.go +++ b/framework/config.go @@ -6,14 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "os" - "path/filepath" - "strings" - "sync" - "testing" - "text/template" - "time" - "github.com/davecgh/go-spew/spew" "github.com/go-playground/validator/v10" "github.com/pelletier/go-toml/v2" @@ -21,6 +13,13 @@ import ( "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/network" + "os" + "path/filepath" + "strings" + "sync" + "testing" + "text/template" + "time" ) const ( @@ -143,12 +142,12 @@ func Load[X any](t *testing.T) (*X, error) { // return nil, fmt.Errorf("failed to connect AWSSecretsManager: %w", err) // } //} - err = DefaultNetwork(t, once) + err = DefaultNetwork(once) require.NoError(t, err) return input, nil } -func DefaultNetwork(t *testing.T, once *sync.Once) error { +func DefaultNetwork(once *sync.Once) error { var net *testcontainers.DockerNetwork var err error once.Do(func() { @@ -156,7 +155,6 @@ func DefaultNetwork(t *testing.T, once *sync.Once) error { context.Background(), network.WithLabels(map[string]string{"framework": "ctf"}), ) - testcontainers.CleanupNetwork(t, net) DefaultNetworkName = net.Name }) return err