func TestMain(m *testing.M) { flag.Parse() // Do not remove this comment, import into google3 depends on it tabletserver.Init() exitCode := func() int { hdl, err := vttest.LaunchVitess(vttest.MySQLOnly("vttest"), vttest.Schema(testSchema), vttest.Verbose(testing.Verbose())) if err != nil { fmt.Fprintf(os.Stderr, "could not launch mysql: %v\n", err) return 1 } defer hdl.TearDown() connParams, err = hdl.MySQLConnParams() if err != nil { fmt.Fprintf(os.Stderr, "could not fetch mysql params: %v\n", err) return 1 } err = framework.StartServer(connParams) if err != nil { fmt.Fprintf(os.Stderr, "%v", err) return 1 } defer framework.StopServer() err = initTableACL() if err != nil { fmt.Fprintf(os.Stderr, "%v", err) return 1 } return m.Run() }() os.Exit(exitCode) }
func TestMain(m *testing.M) { flag.Parse() // Do not remove this comment, import into google3 depends on it tabletserver.Init() exitCode := func() int { hdl, err := vttest.LaunchMySQL("vttest", testSchema, testing.Verbose()) if err != nil { fmt.Fprintf(os.Stderr, "could not launch mysql: %v\n", err) return 1 } defer hdl.TearDown() connParams, err = hdl.MySQLConnParams() if err != nil { fmt.Fprintf(os.Stderr, "could not fetch mysql params: %v\n", err) return 1 } var schemaOverrides []tabletserver.SchemaOverride err = json.Unmarshal([]byte(schemaOverrideJSON), &schemaOverrides) if err != nil { fmt.Fprintf(os.Stderr, "%v", err) return 1 } err = framework.StartServer(connParams, schemaOverrides) if err != nil { fmt.Fprintf(os.Stderr, "%v", err) return 1 } defer framework.StopServer() err = initTableACL() if err != nil { fmt.Fprintf(os.Stderr, "%v", err) return 1 } return m.Run() }() os.Exit(exitCode) }