Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps committed Dec 10, 2024
1 parent a514337 commit f24f97d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions go/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func Execute() {
root.AddCommand(transactionsCmd())
root.AddCommand(planalyzeCmd())

if err := root.ParseFlags(os.Args[1:]); err != nil {
panic(err)
}

if !webserverStarted && port > 0 {
webserverStarted = true
go startWebServer(port, ch)
Expand All @@ -68,6 +72,7 @@ func Execute() {

// FIXME: add sync b/w webserver and root command, for now just add a wait to make sure webserver is running
time.Sleep(2 * time.Second)

err := root.Execute()
if err != nil {
fmt.Printf("Error: %v\n", err)
Expand Down
9 changes: 5 additions & 4 deletions go/end2end/end_to_end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@ func TestApp(t *testing.T) {
args []string
want string
}{
{[]string{"help"}, "Utils tools for testing, running and benchmarking Vitess"},
{[]string{"keys", "t/demo.test"}, `"queryStructure"`},
{[]string{"-p", "0", "help"}, "Utils tools for testing, running and benchmarking Vitess"},
{[]string{"-p", "0", "keys", "t/demo.test"}, `"queryStructure"`},
}
projectRoot, err := filepath.Abs("../../")
require.NoError(t, err)

for _, tt := range tests {
t.Run("vt "+strings.Join(tt.args, " "), func(t *testing.T) {
t.Run("vt "+strings.Join(tt.args, " "), func(t *testing.T) {
cmd := exec.Command("./vt", tt.args...)
cmd.Dir = projectRoot
out, err := cmd.CombinedOutput()
out, err := cmd.Output()
fmt.Printf("err:|%v|\n", err)
require.NoError(t, err, string(out))
require.Contains(t, string(out), tt.want)
})
Expand Down

0 comments on commit f24f97d

Please sign in to comment.