diff --git a/go/test/endtoend/vtcombo/recreate/recreate_test.go b/go/test/endtoend/vtcombo/recreate/recreate_test.go index 56d0c454bbf..15cb63c3d7d 100644 --- a/go/test/endtoend/vtcombo/recreate/recreate_test.go +++ b/go/test/endtoend/vtcombo/recreate/recreate_test.go @@ -22,6 +22,7 @@ import ( "fmt" "os" "os/exec" + "strconv" "strings" "testing" @@ -112,6 +113,8 @@ func TestDropAndRecreateWithSameShards(t *testing.T) { assertTabletsPresent(t) + // Check the connection count after the CREATE. There will be zero connections after the DROP as the database + // no longer exists, but after it gets recreated any open pools will be able to reestablish connections. mysqlConnCountAfter, err := getMySQLConnectionCount(ctx, cur) require.Nil(t, err) @@ -121,16 +124,11 @@ func TestDropAndRecreateWithSameShards(t *testing.T) { } func getMySQLConnectionCount(ctx context.Context, session *vtgateconn.VTGateSession) (int, error) { - result, err := session.Execute(ctx, "SELECT COUNT(*) FROM information_schema.processlist", nil) + result, err := session.Execute(ctx, "select variable_value from performance_schema.global_status where variable_name='threads_connected'", nil) if err != nil { return 0, err } - row := result.Rows[0][0] - toInt, err := row.ToInt() - if err != nil { - return 0, err - } - return toInt, nil + return strconv.Atoi(result.Rows[0][0].ToString()) } func assertTabletsPresent(t *testing.T) {