diff --git a/go/test/endtoend/utils/cmp.go b/go/test/endtoend/utils/cmp.go index bf4eb5e14c1..dd9614e79fa 100644 --- a/go/test/endtoend/utils/cmp.go +++ b/go/test/endtoend/utils/cmp.go @@ -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() } diff --git a/go/test/endtoend/vtgate/queries/misc/misc_test.go b/go/test/endtoend/vtgate/queries/misc/misc_test.go index 55f2398c75f..d791692b3b7 100644 --- a/go/test/endtoend/vtgate/queries/misc/misc_test.go +++ b/go/test/endtoend/vtgate/queries/misc/misc_test.go @@ -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)) } }) }