Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions go/test/endtoend/backup/vtbackup/backup_only_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/mysqlctl"
"vitess.io/vitess/go/vt/utils"
)

var (
Expand Down Expand Up @@ -240,12 +239,12 @@ func startVtBackup(t *testing.T, initialBackup bool, restartBeforeBackup, disabl
extraArgs := []string{
"--allow_first_backup",
"--db-credentials-file", dbCredentialFile,
utils.GetFlagVariantForTests("--mysql-socket"), mysqlSocket.Name(),
"--mysql-socket", mysqlSocket.Name(),

// Use opentsdb for stats.
utils.GetFlagVariantForTests("--stats-backend"), "opentsdb",
"--stats-backend", "opentsdb",
// Write stats to file for reading afterwards.
utils.GetFlagVariantForTests("--opentsdb-uri"), "file://" + statsPath,
"--opentsdb-uri", "file://" + statsPath,
}
if restartBeforeBackup {
extraArgs = append(extraArgs, "--restart_before_backup")
Expand Down
13 changes: 6 additions & 7 deletions go/test/endtoend/backup/vtbackup/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/test/endtoend/utils"
"vitess.io/vitess/go/vt/log"
vtutils "vitess.io/vitess/go/vt/utils"
)

var (
Expand All @@ -44,12 +43,12 @@ var (
shardKsName = fmt.Sprintf("%s/%s", keyspaceName, shardName)
dbCredentialFile string
commonTabletArg = []string{
vtutils.GetFlagVariantForTests("--vreplication-retry-delay"), "1s",
vtutils.GetFlagVariantForTests("--degraded-threshold"), "5s",
vtutils.GetFlagVariantForTests("--lock-tables-timeout"), "5s",
vtutils.GetFlagVariantForTests("--watch-replication-stream"),
vtutils.GetFlagVariantForTests("--enable-replication-reporter"),
vtutils.GetFlagVariantForTests("--serving-state-grace-period"), "1s"}
"--vreplication-retry-delay", "1s",
"--degraded-threshold", "5s",
"--lock-tables-timeout", "5s",
"--watch-replication-stream",
"--enable-replication-reporter",
"--serving-state-grace-period", "1s"}
)

func TestMain(m *testing.M) {
Expand Down
33 changes: 16 additions & 17 deletions go/test/endtoend/backup/vtctlbackup/backup_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
"vitess.io/vitess/go/vt/proto/topodata"
"vitess.io/vitess/go/vt/proto/vtrpc"
"vitess.io/vitess/go/vt/sqlparser"
vtutils "vitess.io/vitess/go/vt/utils"
"vitess.io/vitess/go/vt/vterrors"
)

Expand Down Expand Up @@ -144,16 +143,16 @@ func LaunchCluster(setupType int, streamMode string, stripes int, cDetails *Comp
switch setupType {
case XtraBackup:
xtrabackupArgs := []string{
vtutils.GetFlagVariantForTests("--backup-engine-implementation"), "xtrabackup",
fmt.Sprintf("%s=%s", vtutils.GetFlagVariantForTests("--xtrabackup-stream-mode"), streamMode),
vtutils.GetFlagVariantForTests("--xtrabackup-user") + "=vt_dba",
fmt.Sprintf("%s=%d", vtutils.GetFlagVariantForTests("--xtrabackup-stripes"), stripes),
vtutils.GetFlagVariantForTests("--xtrabackup-backup-flags"), "--password=" + dbPassword,
"--backup-engine-implementation", "xtrabackup",
fmt.Sprintf("%s=%s", "--xtrabackup-stream-mode", streamMode),
"--xtrabackup-user" + "=vt_dba",
fmt.Sprintf("%s=%d", "--xtrabackup-stripes", stripes),
"--xtrabackup-backup-flags", "--password=" + dbPassword,
}

// if streamMode is xbstream, add some additional args to test other xtrabackup flags
if streamMode == "xbstream" {
xtrabackupArgs = append(xtrabackupArgs, vtutils.GetFlagVariantForTests("--xtrabackup-prepare-flags"), "--use-memory=100M")
xtrabackupArgs = append(xtrabackupArgs, "--xtrabackup-prepare-flags", "--use-memory=100M")
}

commonTabletArg = append(commonTabletArg, xtrabackupArgs...)
Expand All @@ -165,7 +164,7 @@ func LaunchCluster(setupType int, streamMode string, stripes int, cDetails *Comp
}

mysqlShellArgs := []string{
vtutils.GetFlagVariantForTests("--backup-engine-implementation"), "mysqlshell",
"--backup-engine-implementation", "mysqlshell",
"--mysql-shell-backup-location", mysqlShellBackupLocation,
"--mysql-shell-speedup-restore=true",
}
Expand Down Expand Up @@ -990,10 +989,10 @@ func restoreWaitForBackup(t *testing.T, tabletType string, cDetails *Compression
replicaTabletArgs = updateCompressorArgs(replicaTabletArgs, cDetails)
}
if fakeImpl {
replicaTabletArgs = append(replicaTabletArgs, vtutils.GetFlagVariantForTests("--backup-engine-implementation"), "fake_implementation")
replicaTabletArgs = append(replicaTabletArgs, "--backup-engine-implementation", "fake_implementation")
}
replicaTabletArgs = append(replicaTabletArgs, vtutils.GetFlagVariantForTests("--wait-for-backup-interval"), "1s")
replicaTabletArgs = append(replicaTabletArgs, vtutils.GetFlagVariantForTests("--init-tablet-type"), tabletType)
replicaTabletArgs = append(replicaTabletArgs, "--wait-for-backup-interval", "1s")
replicaTabletArgs = append(replicaTabletArgs, "--init-tablet-type", tabletType)
replica2.VttabletProcess.ExtraArgs = replicaTabletArgs
replica2.VttabletProcess.ServingStatus = ""
err := replica2.VttabletProcess.Setup()
Expand Down Expand Up @@ -1491,12 +1490,12 @@ func verifyTabletRestoreStats(t *testing.T, vars map[string]any) {

func getDefaultCommonArgs() []string {
return []string{
vtutils.GetFlagVariantForTests("--vreplication-retry-delay"), "1s",
vtutils.GetFlagVariantForTests("--degraded-threshold"), "5s",
vtutils.GetFlagVariantForTests("--lock-tables-timeout"), "5s",
vtutils.GetFlagVariantForTests("--watch-replication-stream"),
vtutils.GetFlagVariantForTests("--enable-replication-reporter"),
vtutils.GetFlagVariantForTests("--serving-state-grace-period"), "1s",
"--vreplication-retry-delay", "1s",
"--degraded-threshold", "5s",
"--lock-tables-timeout", "5s",
"--watch-replication-stream",
"--enable-replication-reporter",
"--serving-state-grace-period", "1s",
}
}

Expand Down
15 changes: 7 additions & 8 deletions go/test/endtoend/cellalias/cell_alias_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (

"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/vt/proto/topodata"
"vitess.io/vitess/go/vt/utils"
)

var (
Expand All @@ -54,13 +53,13 @@ var (
) Engine=InnoDB
`
commonTabletArg = []string{
utils.GetFlagVariantForTests("--vreplication-retry-delay"), "1s",
utils.GetFlagVariantForTests("--degraded-threshold"), "5s",
utils.GetFlagVariantForTests("--lock-tables-timeout"), "5s",
utils.GetFlagVariantForTests("--watch-replication-stream"),
utils.GetFlagVariantForTests("--enable-replication-reporter"),
utils.GetFlagVariantForTests("--serving-state-grace-period"), "1s",
utils.GetFlagVariantForTests("--binlog-player-protocol"), "grpc",
"--vreplication-retry-delay", "1s",
"--degraded-threshold", "5s",
"--lock-tables-timeout", "5s",
"--watch-replication-stream",
"--enable-replication-reporter",
"--serving-state-grace-period", "1s",
"--binlog-player-protocol", "grpc",
}
vSchema = `
{
Expand Down
18 changes: 2 additions & 16 deletions go/test/endtoend/cluster/vtbackup_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"time"

"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/utils"
)

// VtbackupProcess is a generic handle for a running Vtbackup.
Expand Down Expand Up @@ -57,10 +56,6 @@ type VtbackupProcess struct {

// Setup starts vtbackup process with required arguements
func (vtbackup *VtbackupProcess) Setup() (err error) {
vtbackupVer, err := GetMajorVersion(vtbackup.Binary)
if err != nil {
return err
}
flags := map[string]string{
"--topo-implementation": vtbackup.TopoImplementation,
"--topo-global-server-address": vtbackup.TopoGlobalAddress,
Expand All @@ -74,19 +69,10 @@ func (vtbackup *VtbackupProcess) Setup() (err error) {
"--init-shard": vtbackup.Shard,

//Backup Arguments are not optional
utils.GetFlagVariantForTestsByVersion("--file-backup-storage-root", vtbackupVer): vtbackup.BackupStorageImplementation,
"--file-backup-storage-root": vtbackup.FileBackupStorageRoot,
"--backup-storage-implementation": vtbackup.BackupStorageImplementation,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was actually wrong before (using --file-backup-storage-root but then passing the value of vtbackup.BackupStorageImplementation).

"--file-backup-storage-root": vtbackup.FileBackupStorageRoot,
}

utils.SetFlagVariantsForTests(flags, "--topo-implementation", vtbackup.TopoImplementation)
utils.SetFlagVariantsForTests(flags, "--topo-global-server-address", vtbackup.TopoGlobalAddress)
utils.SetFlagVariantsForTests(flags, "--topo-global-root", vtbackup.TopoGlobalRoot)
utils.SetFlagVariantsForTests(flags, "--mysql-port", strconv.Itoa(vtbackup.MysqlPort))
utils.SetFlagVariantsForTests(flags, "--init-db-sql-file", vtbackup.initDBfile)
utils.SetFlagVariantsForTests(flags, "--init-keyspace", vtbackup.Keyspace)
utils.SetFlagVariantsForTests(flags, "--init-shard", vtbackup.Shard)
utils.SetFlagVariantsForTests(flags, "--backup-storage-implementation", vtbackup.BackupStorageImplementation)

vtbackup.proc = exec.Command(vtbackup.Binary)
for k, v := range flags {
vtbackup.proc.Args = append(vtbackup.proc.Args, k, v)
Expand Down
8 changes: 1 addition & 7 deletions go/test/endtoend/cluster/vtctld_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (
"syscall"
"time"

vtutils "vitess.io/vitess/go/vt/utils"

"vitess.io/vitess/go/vt/log"
)

Expand All @@ -52,10 +50,6 @@ type VtctldProcess struct {

// Setup starts vtctld process with required arguements
func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) {
vtctldVer, err := GetMajorVersion(vtctld.Binary)
if err != nil {
return err
}
_ = createDirectory(vtctld.LogDir, 0700)
_ = createDirectory(path.Join(vtctld.Directory, "backups"), 0700)
vtctld.proc = exec.Command(
Expand All @@ -67,7 +61,7 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error)
"--cell", cell,
"--service_map", vtctld.ServiceMap,
"--backup_storage_implementation", vtctld.BackupStorageImplementation,
vtutils.GetFlagVariantForTestsByVersion("--file-backup-storage-root", vtctldVer), vtctld.FileBackupStorageRoot,
"--file-backup-storage-root", vtctld.FileBackupStorageRoot,
"--log_dir", vtctld.LogDir,
"--port", strconv.Itoa(vtctld.Port),
"--grpc_port", strconv.Itoa(vtctld.GrpcPort),
Expand Down
5 changes: 0 additions & 5 deletions go/test/endtoend/cluster/vtorc_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"time"

"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/utils"
)

// VTOrcProcess is a test struct for running
Expand Down Expand Up @@ -126,10 +125,6 @@ func (orc *VTOrcProcess) Setup() (err error) {
"--bind-address": "127.0.0.1",
}

utils.SetFlagVariantsForTests(flags, "--topo-implementation", orc.TopoImplementation)
utils.SetFlagVariantsForTests(flags, "--topo-global-server-address", orc.TopoGlobalAddress)
utils.SetFlagVariantsForTests(flags, "--topo-global-root", orc.TopoGlobalRoot)

orc.proc = exec.Command(orc.Binary)
for flag, value := range flags {
orc.proc.Args = append(orc.proc.Args, flag, value)
Expand Down
8 changes: 1 addition & 7 deletions go/test/endtoend/cluster/vttablet_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ import (
"testing"
"time"

vtutils "vitess.io/vitess/go/vt/utils"

"github.com/stretchr/testify/require"

"vitess.io/vitess/go/constants/sidecar"
Expand Down Expand Up @@ -94,10 +92,6 @@ type VttabletProcess struct {

// Setup starts vttablet process with required arguements
func (vttablet *VttabletProcess) Setup() (err error) {
vttabletVer, err := GetMajorVersion(vttablet.Binary)
if err != nil {
return err
}
vttablet.proc = exec.Command(
vttablet.Binary,
//TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
Expand All @@ -116,7 +110,7 @@ func (vttablet *VttabletProcess) Setup() (err error) {
"--health_check_interval", fmt.Sprintf("%ds", vttablet.HealthCheckInterval),
"--enable_replication_reporter",
"--backup_storage_implementation", vttablet.BackupStorageImplementation,
vtutils.GetFlagVariantForTestsByVersion("--file-backup-storage-root", vttabletVer), vttablet.FileBackupStorageRoot,
"--file-backup-storage-root", vttablet.FileBackupStorageRoot,
"--service_map", vttablet.ServiceMap,
"--db_charset", vttablet.Charset,
"--bind-address", "127.0.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/test/endtoend/encryption"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/utils"
)

var (
Expand Down Expand Up @@ -62,9 +61,9 @@ func testReplicationBase(t *testing.T, isClientCertPassed bool) {

if isClientCertPassed {
replicaTablet.VttabletProcess.ExtraArgs = append(replicaTablet.VttabletProcess.ExtraArgs,
utils.GetFlagVariantForTests("--db-flags"), "2048",
utils.GetFlagVariantForTests("--db-ssl-ca"), path.Join(certDirectory, "ca-cert.pem"),
utils.GetFlagVariantForTests("--db-ssl-cert"), path.Join(certDirectory, "client-cert.pem"),
"--db-flags", "2048",
"--db-ssl-ca", path.Join(certDirectory, "ca-cert.pem"),
"--db-ssl-cert", path.Join(certDirectory, "client-cert.pem"),
"--db-ssl-key", path.Join(certDirectory, "client-key.pem"),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import (
"vitess.io/vitess/go/test/endtoend/encryption"

"vitess.io/vitess/go/vt/proto/vtrpc"
"vitess.io/vitess/go/vt/utils"
"vitess.io/vitess/go/vt/vterrors"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -202,7 +201,7 @@ func useEffectiveCallerID(ctx context.Context, t *testing.T) {
// now restart vtgate in the mode where we don't use SSL
// for client connections, but we copy effective caller id
// into immediate caller id.
clusterInstance.VtGateExtraArgs = []string{utils.GetFlagVariantForTests("--grpc-use-effective-callerid")}
clusterInstance.VtGateExtraArgs = []string{"--grpc-use-effective-callerid"}
clusterInstance.VtGateExtraArgs = append(clusterInstance.VtGateExtraArgs, tabletConnExtraArgs("vttablet-client-1")...)
err := clusterInstance.RestartVtgate()
require.NoError(t, err)
Expand Down Expand Up @@ -251,7 +250,7 @@ func useEffectiveGroups(ctx context.Context, t *testing.T) {
// now restart vtgate in the mode where we don't use SSL
// for client connections, but we copy effective caller's groups
// into immediate caller id.
clusterInstance.VtGateExtraArgs = []string{utils.GetFlagVariantForTests("--grpc-use-effective-callerid"), utils.GetFlagVariantForTests("--grpc-use-effective-groups")}
clusterInstance.VtGateExtraArgs = []string{"--grpc-use-effective-callerid", "--grpc-use-effective-groups"}
clusterInstance.VtGateExtraArgs = append(clusterInstance.VtGateExtraArgs, tabletConnExtraArgs("vttablet-client-1")...)
err := clusterInstance.RestartVtgate()
require.NoError(t, err)
Expand Down Expand Up @@ -424,9 +423,9 @@ func createSignedCert(ca string, serial string, name string, commonName string)

func serverExtraArguments(name string, ca string) []string {
args := []string{
utils.GetFlagVariantForTests("--grpc-cert"), certDirectory + "/" + name + "-cert.pem",
utils.GetFlagVariantForTests("--grpc-key"), certDirectory + "/" + name + "-key.pem",
utils.GetFlagVariantForTests("--grpc-ca"), certDirectory + "/" + ca + "-cert.pem",
"--grpc-cert", certDirectory + "/" + name + "-cert.pem",
"--grpc-key", certDirectory + "/" + name + "-key.pem",
"--grpc-ca", certDirectory + "/" + ca + "-cert.pem",
}
return args
}
Expand All @@ -442,10 +441,10 @@ func tmclientExtraArgs(name string) []string {

func tabletConnExtraArgs(name string) []string {
ca := "vttablet-server"
args := []string{utils.GetFlagVariantForTests("--tablet-grpc-cert"), certDirectory + "/" + name + "-cert.pem",
utils.GetFlagVariantForTests("--tablet-grpc-key"), certDirectory + "/" + name + "-key.pem",
utils.GetFlagVariantForTests("--tablet-grpc-ca"), certDirectory + "/" + ca + "-cert.pem",
utils.GetFlagVariantForTests("--tablet-grpc-server-name"), "vttablet server instance"}
args := []string{"--tablet-grpc-cert", certDirectory + "/" + name + "-cert.pem",
"--tablet-grpc-key", certDirectory + "/" + name + "-key.pem",
"--tablet-grpc-ca", certDirectory + "/" + ca + "-cert.pem",
"--tablet-grpc-server-name", "vttablet server instance"}
return args
}

Expand Down
9 changes: 4 additions & 5 deletions go/test/endtoend/mysqlserver/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/vt/utils"
)

var (
Expand Down Expand Up @@ -110,11 +109,11 @@ func TestMain(m *testing.M) {

clusterInstance.VtGateExtraArgs = []string{
"--vschema-ddl-authorized-users=%",
utils.GetFlagVariantForTests("--mysql-server-query-timeout"), "1s",
utils.GetFlagVariantForTests("--mysql-auth-server-impl"), "static",
"--mysql-server-query-timeout", "1s",
"--mysql-auth-server-impl", "static",
"--mysql-auth-server-static-file", clusterInstance.TmpDirectory + mysqlAuthServerStatic,
utils.GetFlagVariantForTests("--mysql-server-version"), "8.0.16-7",
utils.GetFlagVariantForTests("--warn-sharded-only") + "=true",
"--mysql-server-version", "8.0.16-7",
"--warn-sharded-only" + "=true",
}

clusterInstance.VtTabletExtraArgs = []string{
Expand Down
11 changes: 5 additions & 6 deletions go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"vitess.io/vitess/go/vt/log"
tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata"
"vitess.io/vitess/go/vt/schema"
"vitess.io/vitess/go/vt/utils"
"vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/throttlerapp"

"vitess.io/vitess/go/test/endtoend/cluster"
Expand Down Expand Up @@ -157,13 +156,13 @@ func TestMain(m *testing.M) {
}

clusterInstance.VtTabletExtraArgs = []string{
utils.GetFlagVariantForTests("--heartbeat-interval"), "250ms",
utils.GetFlagVariantForTests("--heartbeat-on-demand-duration"), "5s",
utils.GetFlagVariantForTests("--migration-check-interval"), "5s",
utils.GetFlagVariantForTests("--watch-replication-stream"),
"--heartbeat-interval", "250ms",
"--heartbeat-on-demand-duration", "5s",
"--migration-check-interval", "5s",
"--watch-replication-stream",
}
clusterInstance.VtGateExtraArgs = []string{
utils.GetFlagVariantForTests("--ddl-strategy"), "online",
"--ddl-strategy", "online",
}

if err := clusterInstance.StartTopo(); err != nil {
Expand Down
Loading
Loading