Skip to content

Commit a461206

Browse files
committed
bring the whole setup back
1 parent 2c437ce commit a461206

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

framework/components/clnode/clnode.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
184184
Name: containerName,
185185
Labels: framework.DefaultTCLabels(),
186186
Networks: []string{framework.DefaultNetworkName},
187-
//NetworkAliases: map[string][]string{
188-
// framework.DefaultNetworkName: {containerName},
189-
//},
187+
NetworkAliases: map[string][]string{
188+
framework.DefaultNetworkName: {containerName},
189+
},
190190
ExposedPorts: exposedPorts,
191191
Entrypoint: []string{
192192
"/bin/sh", "-c",
@@ -295,8 +295,8 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
295295
ContainerName: containerName,
296296
InternalIP: ip,
297297
HostURL: fmt.Sprintf("http://%s:%s", host, mp.Port()),
298-
DockerURL: fmt.Sprintf("http://%s:%s", ip, DefaultHTTPPort),
299-
DockerP2PUrl: fmt.Sprintf("http://%s:%s", ip, DefaultP2PPort),
298+
DockerURL: fmt.Sprintf("http://%s:%s", host, DefaultHTTPPort),
299+
DockerP2PUrl: fmt.Sprintf("http://%s:%s", host, DefaultP2PPort),
300300
}, nil
301301
}
302302

framework/config.go

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import (
1111
"github.com/pelletier/go-toml/v2"
1212
"github.com/rs/zerolog"
1313
"github.com/stretchr/testify/require"
14+
"github.com/testcontainers/testcontainers-go"
15+
"github.com/testcontainers/testcontainers-go/network"
1416
"os"
1517
"path/filepath"
1618
"strings"
1719
"sync"
1820
"testing"
1921
"text/template"
2022
"time"
21-
22-
tc "github.com/testcontainers/testcontainers-go"
2323
)
2424

2525
const (
@@ -146,22 +146,14 @@ func Load[X any](t *testing.T) (*X, error) {
146146
}
147147

148148
func DefaultNetwork(once *sync.Once) error {
149+
var net *testcontainers.DockerNetwork
149150
var err error
150-
name := "ctf"
151151
once.Do(func() {
152-
f := false
153-
//nolint:staticcheck
154-
_, err := tc.GenericNetwork(context.Background(), tc.GenericNetworkRequest{
155-
//nolint:staticcheck
156-
NetworkRequest: tc.NetworkRequest{
157-
Name: name,
158-
EnableIPv6: &f,
159-
},
160-
})
161-
if err != nil {
162-
panic(fmt.Errorf("failed to create default network: %w", err))
163-
}
164-
DefaultNetworkName = name
152+
net, err = network.New(
153+
context.Background(),
154+
network.WithLabels(map[string]string{"framework": "ctf"}),
155+
)
156+
DefaultNetworkName = net.Name
165157
})
166158
return err
167159
}

0 commit comments

Comments
 (0)