Skip to content

Commit 29e91df

Browse files
Make --file-backup-storage-root dependent on binary version
Signed-off-by: Rohit Nayak <[email protected]>
1 parent 6f9bb6b commit 29e91df

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

go/flags/endtoend/vtctld.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vtctld \
1616
--topo-global-root /vitess/ \
1717
--service-map 'grpc-vtctl,grpc-vtctld' \
1818
--backup-storage-implementation file \
19-
--file_backup_storage_root $VTDATAROOT/backups \
19+
--file-backup-storage-root $VTDATAROOT/backups \
2020
--port 15000 \
2121
--grpc-port 15999
2222

go/test/endtoend/cluster/vtbackup_process.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ type VtbackupProcess struct {
5656

5757
// Setup starts vtbackup process with required arguements
5858
func (vtbackup *VtbackupProcess) Setup() (err error) {
59-
59+
vtbackupVer, err := GetMajorVersion(vtbackup.Binary)
60+
if err != nil {
61+
return err
62+
}
6063
flags := map[string]string{
6164
"--topo-implementation": vtbackup.TopoImplementation,
6265
"--topo-global-server-address": vtbackup.TopoGlobalAddress,
@@ -70,8 +73,8 @@ func (vtbackup *VtbackupProcess) Setup() (err error) {
7073
"--init-shard": vtbackup.Shard,
7174

7275
//Backup Arguments are not optional
73-
"--backup-storage-implementation": vtbackup.BackupStorageImplementation,
74-
"--file-backup-storage-root": vtbackup.FileBackupStorageRoot,
76+
utils.GetFlagVariantForTestsByVersion("--file-backup-storage-root", vtbackupVer): vtbackup.BackupStorageImplementation,
77+
"--file-backup-storage-root": vtbackup.FileBackupStorageRoot,
7578
}
7679

7780
utils.SetFlagVariantsForTests(flags, "--topo-implementation", vtbackup.TopoImplementation)

go/test/endtoend/cluster/vtctld_process.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"strings"
2626
"syscall"
2727
"time"
28+
vtutils "vitess.io/vitess/go/vt/utils"
2829

2930
"vitess.io/vitess/go/vt/log"
3031
)
@@ -49,6 +50,10 @@ type VtctldProcess struct {
4950

5051
// Setup starts vtctld process with required arguements
5152
func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) {
53+
vtctldVer, err := GetMajorVersion(vtctld.Binary)
54+
if err != nil {
55+
return err
56+
}
5257
_ = createDirectory(vtctld.LogDir, 0700)
5358
_ = createDirectory(path.Join(vtctld.Directory, "backups"), 0700)
5459
vtctld.proc = exec.Command(
@@ -60,7 +65,7 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error)
6065
"--cell", cell,
6166
"--service_map", vtctld.ServiceMap,
6267
"--backup_storage_implementation", vtctld.BackupStorageImplementation,
63-
"--file-backup-storage-root", vtctld.FileBackupStorageRoot,
68+
vtutils.GetFlagVariantForTestsByVersion("--file-backup-storage-root", vtctldVer), vtctld.FileBackupStorageRoot,
6469
"--log_dir", vtctld.LogDir,
6570
"--port", fmt.Sprintf("%d", vtctld.Port),
6671
"--grpc_port", fmt.Sprintf("%d", vtctld.GrpcPort),

go/test/endtoend/cluster/vttablet_process.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"syscall"
3636
"testing"
3737
"time"
38+
vtutils "vitess.io/vitess/go/vt/utils"
3839

3940
"github.com/stretchr/testify/require"
4041

@@ -92,6 +93,10 @@ type VttabletProcess struct {
9293

9394
// Setup starts vttablet process with required arguements
9495
func (vttablet *VttabletProcess) Setup() (err error) {
96+
vttabletVer, err := GetMajorVersion(vttablet.Binary)
97+
if err != nil {
98+
return err
99+
}
95100
vttablet.proc = exec.Command(
96101
vttablet.Binary,
97102
//TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
@@ -110,7 +115,7 @@ func (vttablet *VttabletProcess) Setup() (err error) {
110115
"--health_check_interval", fmt.Sprintf("%ds", vttablet.HealthCheckInterval),
111116
"--enable_replication_reporter",
112117
"--backup_storage_implementation", vttablet.BackupStorageImplementation,
113-
"--file-backup-storage-root", vttablet.FileBackupStorageRoot,
118+
vtutils.GetFlagVariantForTestsByVersion("--file-backup-storage-root", vttabletVer), vttablet.FileBackupStorageRoot,
114119
"--service_map", vttablet.ServiceMap,
115120
"--db_charset", vttablet.Charset,
116121
"--bind-address", "127.0.0.1",

tools/generate_flag_testdata.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ templatize_help_text() {
1414

1515
export -f templatize_help_text
1616

17-
while read -r testfile; do
17+
find "${DIR}" -iname '*.txt' \
18+
| xargs -n1 -P"$(nproc)" bash -c '
19+
testfile="$0"
1820
base="${testfile##*/}"
1921
binary="${base%.*}"
20-
templatize_help_text "${binary}" > "${testfile}"
21-
done < <(find "${DIR}" -iname '*.txt')
22+
templatize_help_text "$binary" > "$testfile"
23+
echo "done: $testfile"
24+
'

0 commit comments

Comments
 (0)