func TestMain(m *testing.M) { v := m.Run() if v == 0 && testutil.CheckLeakedGoroutine() { os.Exit(1) } os.Exit(v) }
// TestMain sets up an etcd cluster if running the examples. func TestMain(m *testing.M) { useCluster := true // default to running all tests for _, arg := range os.Args { if strings.HasPrefix(arg, "-test.run=") { exp := strings.Split(arg, "=")[1] match, err := regexp.MatchString(exp, "Example") useCluster = (err == nil && match) || strings.Contains(exp, "Example") break } } v := 0 if useCluster { cfg := integration.ClusterConfig{Size: 3} clus := integration.NewClusterV3(nil, &cfg) endpoints = make([]string, 3) for i := range endpoints { endpoints[i] = clus.Client(i).Endpoints()[0] } v = m.Run() clus.Terminate(nil) } else { v = m.Run() } if v == 0 && testutil.CheckLeakedGoroutine() { os.Exit(1) } os.Exit(v) }
func TestMain(m *testing.M) { os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH) v := m.Run() if v == 0 && testutil.CheckLeakedGoroutine() { os.Exit(1) } os.Exit(v) }
func TestMain(m *testing.M) { os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH) flag.StringVar(&binDir, "bin-dir", "../bin", "The directory for store etcd and etcdctl binaries.") flag.StringVar(&certDir, "cert-dir", "../integration/fixtures", "The directory for store certificate files.") flag.Parse() v := m.Run() if v == 0 && testutil.CheckLeakedGoroutine() { os.Exit(1) } os.Exit(v) }