R.B. Boyer d59efd390c
test: general cleanup and fixes for the container integration test suite (#15959)
- remove dep on consul main module
- use 'consul tls' subcommands instead of tlsutil
- use direct json config construction instead of agent/config structs
- merge libcluster and libagent packages together
- more widely use BuildContext
- get the OSS/ENT runner stuff working properly
- reduce some flakiness
- fix some correctness related to http/https API
2023-01-11 15:34:27 -06:00

27 lines
612 B
Go

package cluster
import (
"context"
"github.com/pkg/errors"
"github.com/testcontainers/testcontainers-go"
)
func createNetwork(t TestingT, name string) (testcontainers.Network, error) {
req := testcontainers.GenericNetworkRequest{
NetworkRequest: testcontainers.NetworkRequest{
Name: name,
Attachable: true,
CheckDuplicate: true,
},
}
network, err := testcontainers.GenericNetwork(context.Background(), req)
if err != nil {
return nil, errors.Wrap(err, "could not create network")
}
t.Cleanup(func() {
_ = network.Remove(context.Background())
})
return network, nil
}