Skip to content

Commit

Permalink
test: add errors to test log
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Dec 18, 2024
1 parent a1c2707 commit b0b5bd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions go/test/endtoend/utils/cmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ func (mcmp *MySQLCompare) ExecAllowError(query string) (*sqltypes.Result, error)
return vtQr, vtErr
}

func (mcmp *MySQLCompare) VExplain(query string) {
func (mcmp *MySQLCompare) VExplain(query string) string {
mcmp.t.Helper()
vtQr, vtErr := mcmp.VtConn.ExecuteFetch("vexplain plan "+query, 1, true)
require.NoError(mcmp.t, vtErr, "[Vitess Error] for query: "+query)
fmt.Printf("Vitess VExplain Plan: \n%v\n", vtQr.Rows[0][0].ToString())
return vtQr.Rows[0][0].ToString()
}
5 changes: 3 additions & 2 deletions go/test/endtoend/vtgate/queries/misc/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ func TestSetAndGetLastInsertID(t *testing.T) {
mcmp.Run(name, func(mcmp *utils.MySQLCompare) {
mcmp.Exec(query)
mcmp.Exec("select last_insert_id()")
if mcmp.AsT().Failed() {
mcmp.VExplain(query)
t := mcmp.AsT()
if t.Failed() {
t.Log(mcmp.VExplain(query))
}
})
}
Expand Down

0 comments on commit b0b5bd7

Please sign in to comment.