chore(deps): Bump github.com/testcontainers/testcontainers-go from 0.26.0 to 0.27.0 (#14608)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Josh Powers <powersj@fastmail.com>
This commit is contained in:
parent
4a05bef582
commit
29f7d04172
2
go.mod
2
go.mod
|
|
@ -177,7 +177,7 @@ require (
|
|||
github.com/srebhan/protobufquery v0.0.0-20230803132024-ae4c0d878e55
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tbrandon/mbserver v0.0.0-20170611213546-993e1772cc62
|
||||
github.com/testcontainers/testcontainers-go v0.26.0
|
||||
github.com/testcontainers/testcontainers-go v0.27.0
|
||||
github.com/testcontainers/testcontainers-go/modules/kafka v0.26.1-0.20231116140448-68d5f8983d09
|
||||
github.com/thomasklein94/packer-plugin-libvirt v0.5.0
|
||||
github.com/tidwall/gjson v1.17.0
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -2154,8 +2154,8 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69
|
|||
github.com/tbrandon/mbserver v0.0.0-20170611213546-993e1772cc62 h1:Oj2e7Sae4XrOsk3ij21QjjEgAcVSeo9nkp0dI//cD2o=
|
||||
github.com/tbrandon/mbserver v0.0.0-20170611213546-993e1772cc62/go.mod h1:qUzPVlSj2UgxJkVbH0ZwuuiR46U8RBMDT5KLY78Ifpw=
|
||||
github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0=
|
||||
github.com/testcontainers/testcontainers-go v0.26.0 h1:uqcYdoOHBy1ca7gKODfBd9uTHVK3a7UL848z09MVZ0c=
|
||||
github.com/testcontainers/testcontainers-go v0.26.0/go.mod h1:ICriE9bLX5CLxL9OFQ2N+2N+f+803LNJ1utJb1+Inx0=
|
||||
github.com/testcontainers/testcontainers-go v0.27.0 h1:IeIrJN4twonTDuMuBNQdKZ+K97yd7VrmNGu+lDpYcDk=
|
||||
github.com/testcontainers/testcontainers-go v0.27.0/go.mod h1:+HgYZcd17GshBUZv9b+jKFJ198heWPQq3KQIp2+N+7U=
|
||||
github.com/testcontainers/testcontainers-go/modules/kafka v0.26.1-0.20231116140448-68d5f8983d09 h1:jqohCgCKphLrxHl6crzKJbmlmo8GYUNpTiw/Ib+AFLo=
|
||||
github.com/testcontainers/testcontainers-go/modules/kafka v0.26.1-0.20231116140448-68d5f8983d09/go.mod h1:MBqGe6sHltLHRmjk1K1axtIboCjjATh3+oZObcWYFMg=
|
||||
github.com/thomasklein94/packer-plugin-libvirt v0.5.0 h1:aj2HLHZZM/ClGLIwVp9rrgh+2TOU/w4EiaZHAwCpOgs=
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ func TestDovecotContainerIntegration(t *testing.T) {
|
|||
container := testutil.Container{
|
||||
Image: "dovecot/dovecot",
|
||||
ExposedPorts: []string{servicePort},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/etc/dovecot/dovecot.conf": testdata,
|
||||
},
|
||||
WaitingFor: wait.ForAll(
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ func TestOpenLDAPStartTLSIntegration(t *testing.T) {
|
|||
"LDAP_TLS_CERT_FILE": "server.crt",
|
||||
"LDAP_TLS_KEY_FILE": "server.key",
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/server.pem": pkiPaths.ServerPem,
|
||||
"/server.crt": pkiPaths.ServerCert,
|
||||
"/server.key": pkiPaths.ServerKey,
|
||||
|
|
@ -401,7 +401,7 @@ func TestOpenLDAPLDAPSIntegration(t *testing.T) {
|
|||
"LDAP_TLS_CERT_FILE": "server.crt",
|
||||
"LDAP_TLS_KEY_FILE": "server.key",
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/server.pem": pkiPaths.ServerPem,
|
||||
"/server.crt": pkiPaths.ServerCert,
|
||||
"/server.key": pkiPaths.ServerKey,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ func TestOpenldapStartTLSIntegration(t *testing.T) {
|
|||
"LDAP_TLS_CERT_FILE": "server.crt",
|
||||
"LDAP_TLS_KEY_FILE": "server.key",
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/server.pem": tlsPem,
|
||||
"/server.crt": tlsCert,
|
||||
"/server.key": tlsKey,
|
||||
|
|
@ -181,7 +181,7 @@ func TestOpenldapLDAPSIntegration(t *testing.T) {
|
|||
"LDAP_TLS_CERT_FILE": "server.crt",
|
||||
"LDAP_TLS_KEY_FILE": "server.key",
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/server.pem": tlsPem,
|
||||
"/server.crt": tlsCert,
|
||||
"/server.key": tlsKey,
|
||||
|
|
@ -237,7 +237,7 @@ func TestOpenldapInvalidSSLIntegration(t *testing.T) {
|
|||
"LDAP_TLS_CERT_FILE": "server.crt",
|
||||
"LDAP_TLS_KEY_FILE": "server.key",
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/server.pem": tlsPem,
|
||||
"/server.crt": tlsCert,
|
||||
"/server.key": tlsKey,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ func TestRadiusIntegration(t *testing.T) {
|
|||
container := testutil.Container{
|
||||
Image: "freeradius/freeradius-server",
|
||||
ExposedPorts: []string{"1812/udp"},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/etc/raddb/clients.conf": testdata,
|
||||
"/etc/raddb/mods-config/files/authorize": testdataa,
|
||||
"/etc/raddb/radiusd.conf": testdataaa,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/network"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
|
|
@ -19,7 +19,6 @@ import (
|
|||
)
|
||||
|
||||
const masterName = "mymaster"
|
||||
const networkName = "telegraf-test-redis-sentinel"
|
||||
const sentinelServicePort = "26379"
|
||||
|
||||
func TestRedisSentinelConnectIntegration(t *testing.T) {
|
||||
|
|
@ -28,24 +27,18 @@ func TestRedisSentinelConnectIntegration(t *testing.T) {
|
|||
}
|
||||
|
||||
ctx := context.Background()
|
||||
net, err := testcontainers.GenericNetwork(ctx, testcontainers.GenericNetworkRequest{
|
||||
NetworkRequest: testcontainers.NetworkRequest{
|
||||
Name: networkName,
|
||||
Attachable: true,
|
||||
CheckDuplicate: true,
|
||||
},
|
||||
})
|
||||
net, err := network.New(ctx, network.WithCheckDuplicate())
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
require.NoError(t, net.Remove(ctx), "terminating network failed")
|
||||
}()
|
||||
|
||||
redis := createRedisContainer()
|
||||
redis := createRedisContainer(net.Name)
|
||||
err = redis.Start()
|
||||
require.NoError(t, err, "failed to start container")
|
||||
defer redis.Terminate()
|
||||
|
||||
firstSentinel := createSentinelContainer(redis.Name, wait.ForAll(
|
||||
firstSentinel := createSentinelContainer(redis.Name, net.Name, wait.ForAll(
|
||||
wait.ForLog("+monitor master"),
|
||||
wait.ForListeningPort(nat.Port(sentinelServicePort)),
|
||||
))
|
||||
|
|
@ -53,7 +46,7 @@ func TestRedisSentinelConnectIntegration(t *testing.T) {
|
|||
require.NoError(t, err, "failed to start container")
|
||||
defer firstSentinel.Terminate()
|
||||
|
||||
secondSentinel := createSentinelContainer(redis.Name, wait.ForAll(
|
||||
secondSentinel := createSentinelContainer(redis.Name, net.Name, wait.ForAll(
|
||||
wait.ForLog("+sentinel sentinel"),
|
||||
wait.ForListeningPort(nat.Port(sentinelServicePort)),
|
||||
))
|
||||
|
|
@ -356,7 +349,7 @@ func TestRedisSentinelInfoAll(t *testing.T) {
|
|||
testutil.RequireMetricsEqual(t, expectedMetrics, actualMetrics)
|
||||
}
|
||||
|
||||
func createRedisContainer() testutil.Container {
|
||||
func createRedisContainer(networkName string) testutil.Container {
|
||||
return testutil.Container{
|
||||
Image: "redis:7.0-alpine",
|
||||
Name: "telegraf-test-redis-sentinel-redis",
|
||||
|
|
@ -369,7 +362,7 @@ func createRedisContainer() testutil.Container {
|
|||
}
|
||||
}
|
||||
|
||||
func createSentinelContainer(redisAddress string, waitingFor wait.Strategy) testutil.Container {
|
||||
func createSentinelContainer(redisAddress string, networkName string, waitingFor wait.Strategy) testutil.Container {
|
||||
return testutil.Container{
|
||||
Image: "bitnami/redis-sentinel:7.0",
|
||||
ExposedPorts: []string{sentinelServicePort},
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func TestMariaDBIntegration(t *testing.T) {
|
|||
database := "foo"
|
||||
|
||||
// Determine the test-data mountpoint
|
||||
testdata, err := filepath.Abs("testdata/mariadb")
|
||||
testdata, err := filepath.Abs("testdata/mariadb/expected.sql")
|
||||
require.NoError(t, err, "determining absolute path of test-data failed")
|
||||
|
||||
container := testutil.Container{
|
||||
|
|
@ -50,8 +50,8 @@ func TestMariaDBIntegration(t *testing.T) {
|
|||
"MYSQL_ROOT_PASSWORD": passwd,
|
||||
"MYSQL_DATABASE": database,
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": testdata,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/expected.sql": testdata,
|
||||
},
|
||||
WaitingFor: wait.ForAll(
|
||||
wait.ForLog("mariadbd: ready for connections.").WithOccurrence(2),
|
||||
|
|
@ -139,7 +139,7 @@ func TestPostgreSQLIntegration(t *testing.T) {
|
|||
database := "foo"
|
||||
|
||||
// Determine the test-data mountpoint
|
||||
testdata, err := filepath.Abs("testdata/postgres")
|
||||
testdata, err := filepath.Abs("testdata/postgres/expected.sql")
|
||||
require.NoError(t, err, "determining absolute path of test-data failed")
|
||||
|
||||
container := testutil.Container{
|
||||
|
|
@ -149,8 +149,8 @@ func TestPostgreSQLIntegration(t *testing.T) {
|
|||
"POSTGRES_PASSWORD": passwd,
|
||||
"POSTGRES_DB": database,
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": testdata,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/expected.sql": testdata,
|
||||
},
|
||||
WaitingFor: wait.ForAll(
|
||||
wait.ForLog("database system is ready to accept connections").WithOccurrence(2),
|
||||
|
|
@ -237,14 +237,14 @@ func TestClickHouseIntegration(t *testing.T) {
|
|||
user := "default"
|
||||
|
||||
// Determine the test-data mountpoint
|
||||
testdata, err := filepath.Abs("testdata/clickhouse")
|
||||
testdata, err := filepath.Abs("testdata/clickhouse/expected.sql")
|
||||
require.NoError(t, err, "determining absolute path of test-data failed")
|
||||
|
||||
container := testutil.Container{
|
||||
Image: "yandex/clickhouse-server",
|
||||
ExposedPorts: []string{port, "8123"},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": testdata,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/expected.sql": testdata,
|
||||
},
|
||||
WaitingFor: wait.ForAll(
|
||||
wait.NewHTTPStrategy("/").WithPort(nat.Port("8123")),
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ func TestIntegration_BasicGathering(t *testing.T) {
|
|||
ctr := testutil.Container{
|
||||
Image: "niasar/supervisor:stretch-3.3",
|
||||
ExposedPorts: []string{supervisorPort},
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/etc/supervisor/supervisord.conf": supervisorConfig,
|
||||
},
|
||||
WaitingFor: wait.ForAll(
|
||||
|
|
|
|||
|
|
@ -56,15 +56,15 @@ func TestConnectAndWriteIntegrationSCRAMAuth(t *testing.T) {
|
|||
t.Skip("Skipping integration test in short mode")
|
||||
}
|
||||
|
||||
initdb, err := filepath.Abs("testdata/auth_scram")
|
||||
initdb, err := filepath.Abs("testdata/auth_scram/setup.js")
|
||||
require.NoError(t, err)
|
||||
|
||||
servicePort := "27017"
|
||||
container := testutil.Container{
|
||||
Image: "mongo",
|
||||
ExposedPorts: []string{servicePort},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": initdb,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/setup.js": initdb,
|
||||
},
|
||||
WaitingFor: wait.ForAll(
|
||||
wait.NewHTTPStrategy("/").WithPort(nat.Port(servicePort)),
|
||||
|
|
@ -146,7 +146,7 @@ func TestConnectAndWriteIntegrationX509Auth(t *testing.T) {
|
|||
pki := testutil.NewPKI("../../../testutil/pki")
|
||||
|
||||
// bind mount files
|
||||
initdb, err := filepath.Abs("testdata/auth_x509")
|
||||
initdb, err := filepath.Abs("testdata/auth_x509/setup.js")
|
||||
require.NoError(t, err)
|
||||
cacert, err := filepath.Abs(pki.CACertPath())
|
||||
require.NoError(t, err)
|
||||
|
|
@ -157,8 +157,8 @@ func TestConnectAndWriteIntegrationX509Auth(t *testing.T) {
|
|||
container := testutil.Container{
|
||||
Image: "mongo",
|
||||
ExposedPorts: []string{servicePort},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": initdb,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/setup.js": initdb,
|
||||
"/cacert.pem": cacert,
|
||||
"/server.pem": serverpem,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ func launchTestContainer(t *testing.T) *testutil.Container {
|
|||
Image: "eclipse-mosquitto:2",
|
||||
ExposedPorts: []string{servicePort},
|
||||
WaitingFor: wait.ForListeningPort(servicePort),
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/mosquitto/config/mosquitto.conf": conf,
|
||||
},
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ func TestIntegrationMQTTv3(t *testing.T) {
|
|||
Image: "eclipse-mosquitto:2",
|
||||
ExposedPorts: []string{servicePort},
|
||||
WaitingFor: wait.ForListeningPort(servicePort),
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/mosquitto/config/mosquitto.conf": conf,
|
||||
},
|
||||
}
|
||||
|
|
@ -298,7 +298,7 @@ func TestIntegrationMQTTLayoutNonBatch(t *testing.T) {
|
|||
Image: "eclipse-mosquitto:2",
|
||||
ExposedPorts: []string{servicePort},
|
||||
WaitingFor: wait.ForListeningPort(servicePort),
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/mosquitto/config/mosquitto.conf": conf,
|
||||
},
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ func TestIntegrationMQTTLayoutBatch(t *testing.T) {
|
|||
Image: "eclipse-mosquitto:2",
|
||||
ExposedPorts: []string{servicePort},
|
||||
WaitingFor: wait.ForListeningPort(servicePort),
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/mosquitto/config/mosquitto.conf": conf,
|
||||
},
|
||||
}
|
||||
|
|
@ -475,7 +475,7 @@ func TestIntegrationMQTTLayoutField(t *testing.T) {
|
|||
Image: "eclipse-mosquitto:2",
|
||||
ExposedPorts: []string{servicePort},
|
||||
WaitingFor: wait.ForListeningPort(servicePort),
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/mosquitto/config/mosquitto.conf": conf,
|
||||
},
|
||||
}
|
||||
|
|
@ -590,7 +590,7 @@ func TestIntegrationMQTTLayoutHomieV4(t *testing.T) {
|
|||
Image: "eclipse-mosquitto:2",
|
||||
ExposedPorts: []string{servicePort},
|
||||
WaitingFor: wait.ForListeningPort(servicePort),
|
||||
BindMounts: map[string]string{
|
||||
Files: map[string]string{
|
||||
"/mosquitto/config/mosquitto.conf": conf,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ func TestMysqlIntegration(t *testing.T) {
|
|||
t.Skip("Skipping integration test in short mode")
|
||||
}
|
||||
|
||||
initdb, err := filepath.Abs("testdata/mariadb/initdb")
|
||||
initdb, err := filepath.Abs("testdata/mariadb/initdb/script.sql")
|
||||
require.NoError(t, err)
|
||||
|
||||
// initdb/script.sql creates this database
|
||||
|
|
@ -178,8 +178,8 @@ func TestMysqlIntegration(t *testing.T) {
|
|||
Env: map[string]string{
|
||||
"MARIADB_ROOT_PASSWORD": password,
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": initdb,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/script.sql": initdb,
|
||||
"/out": outDir,
|
||||
},
|
||||
ExposedPorts: []string{servicePort},
|
||||
|
|
@ -244,7 +244,7 @@ func TestPostgresIntegration(t *testing.T) {
|
|||
t.Skip("Skipping integration test in short mode")
|
||||
}
|
||||
|
||||
initdb, err := filepath.Abs("testdata/postgres/initdb")
|
||||
initdb, err := filepath.Abs("testdata/postgres/initdb/init.sql")
|
||||
require.NoError(t, err)
|
||||
|
||||
// initdb/init.sql creates this database
|
||||
|
|
@ -262,8 +262,8 @@ func TestPostgresIntegration(t *testing.T) {
|
|||
Env: map[string]string{
|
||||
"POSTGRES_PASSWORD": password,
|
||||
},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": initdb,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/script.sql": initdb,
|
||||
"/out": outDir,
|
||||
},
|
||||
ExposedPorts: []string{servicePort},
|
||||
|
|
@ -330,7 +330,7 @@ func TestClickHouseIntegration(t *testing.T) {
|
|||
t.Skip("Skipping integration test in short mode")
|
||||
}
|
||||
|
||||
initdb, err := filepath.Abs("testdata/clickhouse/initdb")
|
||||
initdb, err := filepath.Abs("testdata/clickhouse/initdb/init.sql")
|
||||
require.NoError(t, err)
|
||||
|
||||
// initdb/init.sql creates this database
|
||||
|
|
@ -345,8 +345,8 @@ func TestClickHouseIntegration(t *testing.T) {
|
|||
container := testutil.Container{
|
||||
Image: "yandex/clickhouse-server",
|
||||
ExposedPorts: []string{servicePort, "8123"},
|
||||
BindMounts: map[string]string{
|
||||
"/docker-entrypoint-initdb.d": initdb,
|
||||
Files: map[string]string{
|
||||
"/docker-entrypoint-initdb.d/script.sql": initdb,
|
||||
"/out": outDir,
|
||||
},
|
||||
WaitingFor: wait.ForAll(
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ func (g *TestLogConsumer) Accept(l testcontainers.Log) {
|
|||
}
|
||||
|
||||
type Container struct {
|
||||
BindMounts map[string]string
|
||||
Entrypoint []string
|
||||
Env map[string]string
|
||||
Files map[string]string
|
||||
HostConfigModifier func(*dockercontainer.HostConfig)
|
||||
ExposedPorts []string
|
||||
Cmd []string
|
||||
|
|
@ -46,17 +46,21 @@ type Container struct {
|
|||
func (c *Container) Start() error {
|
||||
c.ctx = context.Background()
|
||||
|
||||
containerMounts := make([]testcontainers.ContainerMount, 0, len(c.BindMounts))
|
||||
for k, v := range c.BindMounts {
|
||||
containerMounts = append(containerMounts, testcontainers.BindMount(v, testcontainers.ContainerMountTarget(k)))
|
||||
files := make([]testcontainers.ContainerFile, 0, len(c.Files))
|
||||
for k, v := range c.Files {
|
||||
files = append(files, testcontainers.ContainerFile{
|
||||
ContainerFilePath: k,
|
||||
HostFilePath: v,
|
||||
FileMode: 0o755,
|
||||
})
|
||||
}
|
||||
|
||||
req := testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: testcontainers.ContainerRequest{
|
||||
Mounts: testcontainers.Mounts(containerMounts...),
|
||||
Entrypoint: c.Entrypoint,
|
||||
Env: c.Env,
|
||||
ExposedPorts: c.ExposedPorts,
|
||||
Files: files,
|
||||
HostConfigModifier: c.HostConfigModifier,
|
||||
Cmd: c.Cmd,
|
||||
Image: c.Image,
|
||||
|
|
|
|||
Loading…
Reference in New Issue