Skip to content

Commit

Permalink
Merge pull request #13807 from endocrimes/dani/before-test-fix
Browse files Browse the repository at this point in the history
tests/framework/integration: Fail BeforeTest nesting early
  • Loading branch information
serathius committed Apr 7, 2022
2 parents c83b1ad + 7cc00ec commit a5b9f72
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/framework/integration/testing.go
Expand Up @@ -72,6 +72,10 @@ func BeforeTest(t testutil.TB, opts ...TestOption) {
t.Helper()
options := newTestOptions(opts...)

if insideTestContext {
t.Fatal("already in test context. BeforeTest was likely already called")
}

if options.skipInShort {
testutil.SkipTestIfShortMode(t, "Cannot create clusters in --short tests")
}
Expand All @@ -93,10 +97,6 @@ func BeforeTest(t testutil.TB, opts ...TestOption) {
os.Chdir(previousWD)
})

if insideTestContext {
t.Fatal("already in test context. BeforeTest was likely already called")
}

grpc_logger.Set(zapgrpc.NewLogger(zaptest.NewLogger(t).Named("grpc")))
insideTestContext = true

Expand Down

0 comments on commit a5b9f72

Please sign in to comment.