From 6657d5907ca5cb9913abd30bcc7da777313ea9f3 Mon Sep 17 00:00:00 2001 From: Piotr Tabor Date: Tue, 16 Mar 2021 23:30:23 +0100 Subject: [PATCH] Make sure all integration tests have BeforeTest. The CL disallows to create NewCluster in tests without BeforeTest. --- tests/integration/cluster.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration/cluster.go b/tests/integration/cluster.go index 74e54ca8b..d55b6e38b 100644 --- a/tests/integration/cluster.go +++ b/tests/integration/cluster.go @@ -1272,6 +1272,15 @@ func NewClusterV3(t testutil.TB, cfg *ClusterConfig) *ClusterV3 { t.Helper() testutil.SkipTestIfShortMode(t, "Cannot create clusters in --short tests") + wd, err := os.Getwd() + if err != nil { + t.Fatal(err) + } + if !strings.HasPrefix(wd, os.TempDir()) { + t.Errorf("Working directory '%s' expected to be in temp-dir ('%s')."+ + "Have you executed integration.BeforeTest(t) ?", wd, os.TempDir()) + } + cfg.UseGRPC = true if os.Getenv("CLIENT_DEBUG") != "" { clientv3.SetLogger(grpclog.NewLoggerV2WithVerbosity(os.Stderr, os.Stderr, os.Stderr, 4))