Browse Source

main_test: skip test when invoked via go test

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
Gyuho Lee 6 years ago
parent
commit
9ecbf5d2d1
1 changed files with 4 additions and 1 deletions
  1. 4 1
      main_test.go

+ 4 - 1
main_test.go

@@ -26,7 +26,10 @@ func TestMain(t *testing.T) {
 	// don't launch etcd server when invoked via go test
 	// Note: module name has /v3 now
 	if strings.HasSuffix(os.Args[0], "v3.test") {
-		return
+		t.Skip("skip launching etcd server when invoked via go test")
+	}
+	if len(os.Args) > 1 && strings.HasPrefix(os.Args[1], "-test.") {
+		t.Skip("skip launching etcd server when invoked via go test")
 	}
 
 	notifier := make(chan os.Signal, 1)