This commit is contained in:
Todd Gruben 2022-02-14 14:41:22 -06:00
parent d4b7d0cb57
commit cbc9bf71a1
2 changed files with 11 additions and 5 deletions

View file

@ -42,6 +42,9 @@ func realMain() int {
Short: "convert roaring pilosa backup to rbf",
Long: `roaring-migrate uses the pilosa data-dir for each node, and produces a new backup that is able to be restored from utilizing the new pilosa restore tool.`,
Run: func(cmd *cobra.Command, args []string) {
if verbose {
glogger.Infof("Version: %v", Version)
}
nodes := strings.Split(dataDir, ",")
for _, nodePath := range nodes {
err := Migrate(nodePath, backupPath, verbose)
@ -66,13 +69,10 @@ func realMain() int {
glogger.Errorf("Error setting flag backup-dir")
return 1
}
if verbose {
glogger.Infof("Version: %v", Version)
}
err = cmdMigrate.Execute()
if err != nil {
glogger.Errorf("exec error", err)
glogger.Errorf("exec error %v", err)
return 1
}
return 0

View file

@ -27,6 +27,12 @@ func TestFileExists(t *testing.T) {
}
func TestMainProgram(t *testing.T) {
os.Args = []string{"roaring-migrate",
"--verbose",
}
if realMain() == 0 {
t.Fatal("should fail and it succeeded")
}
os.Args = []string{"roaring-migrate",
"--verbose",
}
@ -39,7 +45,7 @@ func TestMainProgram(t *testing.T) {
}
defer os.RemoveAll(dir) // clean up
os.Args = []string{"roaring-migrate",
"--verbose",
"--verbose=true",
"--data-dir=testdata/data-dir/",
"--backup-dir=" + dir,
}