Skip to content

Commit 14b5e61

Browse files
committed
add suffix to network name for unique identification in integration tests
1 parent f9631dc commit 14b5e61

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

integration_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ const (
100100
bearerToken = "testToken1"
101101
)
102102

103+
var networkNameSuffix = 1
104+
103105
func setupQuestDB(ctx context.Context, auth ilpAuthType) (*questdbContainer, error) {
104106
return setupQuestDB0(ctx, auth, false)
105107
}
@@ -132,12 +134,15 @@ func setupQuestDB0(ctx context.Context, auth ilpAuthType, setupProxy bool) (*que
132134
if err != nil {
133135
return nil, err
134136
}
137+
138+
networkNameWithSuffix := fmt.Sprintf("%s_%d", networkName, networkNameSuffix)
139+
networkNameSuffix++
135140
req := testcontainers.ContainerRequest{
136141
Image: "questdb/questdb:9.0.2",
137142
ExposedPorts: []string{"9000/tcp", "9009/tcp"},
138143
WaitingFor: wait.ForHTTP("/").WithPort("9000"),
139-
Networks: []string{networkName},
140-
NetworkAliases: map[string][]string{networkName: {"questdb"}},
144+
Networks: []string{networkNameWithSuffix},
145+
NetworkAliases: map[string][]string{networkNameWithSuffix: {"questdb"}},
141146
Env: env,
142147
Mounts: testcontainers.Mounts(testcontainers.ContainerMount{
143148
Source: testcontainers.GenericBindMountSource{
@@ -149,7 +154,7 @@ func setupQuestDB0(ctx context.Context, auth ilpAuthType, setupProxy bool) (*que
149154

150155
newNetwork, err := testcontainers.GenericNetwork(ctx, testcontainers.GenericNetworkRequest{
151156
NetworkRequest: testcontainers.NetworkRequest{
152-
Name: networkName,
157+
Name: networkNameWithSuffix,
153158
CheckDuplicate: true,
154159
},
155160
})
@@ -196,7 +201,7 @@ func setupQuestDB0(ctx context.Context, auth ilpAuthType, setupProxy bool) (*que
196201
Image: "haproxy:2.6.4",
197202
ExposedPorts: []string{"8443/tcp", "8444/tcp", "8445/tcp", "8888/tcp"},
198203
WaitingFor: wait.ForHTTP("/").WithPort("8888"),
199-
Networks: []string{networkName},
204+
Networks: []string{networkNameWithSuffix},
200205
Mounts: testcontainers.Mounts(testcontainers.ContainerMount{
201206
Source: testcontainers.GenericBindMountSource{
202207
HostPath: path,

0 commit comments

Comments
 (0)