test: remove unecessary flag in sql input (#11115)

This commit is contained in:
Joshua Powers 2022-05-17 14:30:18 -06:00 committed by GitHub
parent c8796a71ae
commit d0476898e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 99 additions and 108 deletions

View File

@ -2,7 +2,6 @@ package sql
import (
"context"
"flag"
"fmt"
"testing"
"time"
@ -31,8 +30,6 @@ func pwgen(n int) string {
return string(buffer)
}
var spinup = flag.Bool("spinup", false, "Spin-up the required test containers")
func TestMariaDB(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
@ -45,7 +42,6 @@ func TestMariaDB(t *testing.T) {
passwd := ""
database := "foo"
if *spinup {
logger.Infof("Spinning up container...")
// Generate a random password
@ -65,7 +61,7 @@ func TestMariaDB(t *testing.T) {
"MYSQL_DATABASE": database,
},
BindMounts: map[string]string{
testdata: "/docker-entrypoint-initdb.d",
"/docker-entrypoint-initdb.d": testdata,
},
ExposedPorts: []string{"3306/tcp"},
WaitingFor: wait.ForListeningPort("3306/tcp"),
@ -84,7 +80,6 @@ func TestMariaDB(t *testing.T) {
p, err := container.MappedPort(ctx, "3306/tcp")
require.NoError(t, err, "getting container host port failed")
port = p.Port()
}
// Define the testset
var testset = []struct {
@ -164,7 +159,6 @@ func TestPostgreSQL(t *testing.T) {
passwd := ""
database := "foo"
if *spinup {
logger.Infof("Spinning up container...")
// Generate a random password
@ -184,7 +178,7 @@ func TestPostgreSQL(t *testing.T) {
"POSTGRES_DB": database,
},
BindMounts: map[string]string{
testdata: "/docker-entrypoint-initdb.d",
"/docker-entrypoint-initdb.d": testdata,
},
ExposedPorts: []string{"5432/tcp"},
WaitingFor: wait.ForListeningPort("5432/tcp"),
@ -203,7 +197,6 @@ func TestPostgreSQL(t *testing.T) {
p, err := container.MappedPort(ctx, "5432/tcp")
require.NoError(t, err, "getting container host port failed")
port = p.Port()
}
// Define the testset
var testset = []struct {
@ -282,7 +275,6 @@ func TestClickHouse(t *testing.T) {
port := "9000"
user := "default"
if *spinup {
logger.Infof("Spinning up container...")
// Determine the test-data mountpoint
@ -295,7 +287,7 @@ func TestClickHouse(t *testing.T) {
ContainerRequest: testcontainers.ContainerRequest{
Image: "yandex/clickhouse-server",
BindMounts: map[string]string{
testdata: "/docker-entrypoint-initdb.d",
"/docker-entrypoint-initdb.d": testdata,
},
ExposedPorts: []string{"9000/tcp", "8123/tcp"},
WaitingFor: wait.NewHTTPStrategy("/").WithPort("8123/tcp"),
@ -314,7 +306,6 @@ func TestClickHouse(t *testing.T) {
p, err := container.MappedPort(ctx, "9000/tcp")
require.NoError(t, err, "getting container host port failed")
port = p.Port()
}
// Define the testset
var testset = []struct {

View File

@ -179,8 +179,8 @@ func TestMysqlIntegration(t *testing.T) {
"MARIADB_ROOT_PASSWORD": password,
},
BindMounts: map[string]string{
initdb: "/docker-entrypoint-initdb.d",
outDir: "/out",
"/docker-entrypoint-initdb.d": initdb,
"/out": outDir,
},
ExposedPorts: []string{"3306/tcp"},
WaitingFor: wait.ForListeningPort("3306/tcp"),
@ -267,8 +267,8 @@ func TestPostgresIntegration(t *testing.T) {
"POSTGRES_PASSWORD": password,
},
BindMounts: map[string]string{
initdb: "/docker-entrypoint-initdb.d",
outDir: "/out",
"/docker-entrypoint-initdb.d": initdb,
"/out": outDir,
},
ExposedPorts: []string{"5432/tcp"},
WaitingFor: wait.ForListeningPort("5432/tcp"),
@ -364,8 +364,8 @@ func TestClickHouseIntegration(t *testing.T) {
ContainerRequest: testcontainers.ContainerRequest{
Image: "yandex/clickhouse-server",
BindMounts: map[string]string{
initdb: "/docker-entrypoint-initdb.d",
outDir: "/out",
"/docker-entrypoint-initdb.d": initdb,
"/out": outDir,
},
ExposedPorts: []string{"9000/tcp", "8123/tcp"},
WaitingFor: wait.NewHTTPStrategy("/").WithPort("8123/tcp"),