Skip to content

Commit 38eef69

Browse files
committed
Reset zerolog’s log level after each integration test.
1 parent fa1264e commit 38eef69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/verifier/integration_test_suite.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/10gen/migration-verifier/internal/util"
99
mapset "github.com/deckarep/golang-set/v2"
1010
"github.com/pkg/errors"
11+
"github.com/rs/zerolog"
1112
"github.com/stretchr/testify/suite"
1213
"go.mongodb.org/mongo-driver/bson"
1314
"go.mongodb.org/mongo-driver/mongo"
@@ -27,6 +28,8 @@ type IntegrationTestSuite struct {
2728
testContext context.Context
2829
contextCanceller context.CancelCauseFunc
2930
initialDbNames mapset.Set[string]
31+
32+
zerologGlobalLogLevel zerolog.Level
3033
}
3134

3235
var _ suite.TestingSuite = &IntegrationTestSuite{}
@@ -111,11 +114,14 @@ func (suite *IntegrationTestSuite) SetupTest() {
111114
}
112115

113116
suite.testContext, suite.contextCanceller = ctx, canceller
117+
suite.zerologGlobalLogLevel = zerolog.GlobalLevel()
114118
}
115119

116120
func (suite *IntegrationTestSuite) TearDownTest() {
117121
suite.T().Logf("Tearing down test %#q", suite.T().Name())
118122

123+
zerolog.SetGlobalLevel(suite.zerologGlobalLogLevel)
124+
119125
suite.contextCanceller(errors.Errorf("tearing down test %#q", suite.T().Name()))
120126
suite.testContext, suite.contextCanceller = nil, nil
121127
ctx := context.Background()

0 commit comments

Comments
 (0)