Skip to content

Commit

Permalink
chore(deps): Bump github.com/testcontainers/testcontainers-go from 0.…
Browse files Browse the repository at this point in the history
…26.0 to 0.27.0 (influxdata#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>
  • Loading branch information
dependabot[bot] and powersj authored Jan 23, 2024
1 parent 4a05bef commit 29f7d04
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 65 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/dovecot/dovecot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions plugins/inputs/ldap/ldap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions plugins/inputs/openldap/openldap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/radius/radius_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 7 additions & 14 deletions plugins/inputs/redis_sentinel/redis_sentinel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ 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"
"github.com/influxdata/telegraf/testutil"
)

const masterName = "mymaster"
const networkName = "telegraf-test-redis-sentinel"
const sentinelServicePort = "26379"

func TestRedisSentinelConnectIntegration(t *testing.T) {
Expand All @@ -28,32 +27,26 @@ 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)),
))
err = firstSentinel.Start()
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)),
))
Expand Down Expand Up @@ -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",
Expand All @@ -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},
Expand Down
18 changes: 9 additions & 9 deletions plugins/inputs/sql/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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),
Expand Down Expand Up @@ -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{
Expand All @@ -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),
Expand Down Expand Up @@ -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")),
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/supervisor/supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
16 changes: 8 additions & 8 deletions plugins/outputs/mongodb/mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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)
Expand All @@ -157,10 +157,10 @@ func TestConnectAndWriteIntegrationX509Auth(t *testing.T) {
container := testutil.Container{
Image: "mongo",
ExposedPorts: []string{servicePort},
BindMounts: map[string]string{
"/docker-entrypoint-initdb.d": initdb,
"/cacert.pem": cacert,
"/server.pem": serverpem,
Files: map[string]string{
"/docker-entrypoint-initdb.d/setup.js": initdb,
"/cacert.pem": cacert,
"/server.pem": serverpem,
},
Entrypoint: []string{
"docker-entrypoint.sh",
Expand Down
12 changes: 6 additions & 6 deletions plugins/outputs/mqtt/mqtt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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,
},
}
Expand Down
24 changes: 12 additions & 12 deletions plugins/outputs/sql/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -178,9 +178,9 @@ func TestMysqlIntegration(t *testing.T) {
Env: map[string]string{
"MARIADB_ROOT_PASSWORD": password,
},
BindMounts: map[string]string{
"/docker-entrypoint-initdb.d": initdb,
"/out": outDir,
Files: map[string]string{
"/docker-entrypoint-initdb.d/script.sql": initdb,
"/out": outDir,
},
ExposedPorts: []string{servicePort},
WaitingFor: wait.ForAll(
Expand Down Expand Up @@ -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
Expand All @@ -262,9 +262,9 @@ func TestPostgresIntegration(t *testing.T) {
Env: map[string]string{
"POSTGRES_PASSWORD": password,
},
BindMounts: map[string]string{
"/docker-entrypoint-initdb.d": initdb,
"/out": outDir,
Files: map[string]string{
"/docker-entrypoint-initdb.d/script.sql": initdb,
"/out": outDir,
},
ExposedPorts: []string{servicePort},
WaitingFor: wait.ForAll(
Expand Down Expand Up @@ -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
Expand All @@ -345,9 +345,9 @@ 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,
"/out": outDir,
Files: map[string]string{
"/docker-entrypoint-initdb.d/script.sql": initdb,
"/out": outDir,
},
WaitingFor: wait.ForAll(
wait.NewHTTPStrategy("/").WithPort(nat.Port("8123")),
Expand Down
Loading

0 comments on commit 29f7d04

Please sign in to comment.