Skip to content

Commit

Permalink
fix: Add config and registry clearing to TestLogWritesMessagesToFeedb…
Browse files Browse the repository at this point in the history
…ackLog (#596)

Relevant issue(s)
Resolves #595

Description
This PR fixes an issues where the troubled test function, when running before another test function that specified an empty log path slice, would cause the config global to keep an invalid output path in memory.
  • Loading branch information
fredcarle authored Jul 6, 2022
1 parent b14bb85 commit 0f54d22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logging/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ func getFeedbackLogLevelTestCase() []LogLevelTestCase {
}

func TestLogWritesMessagesToFeedbackLog(t *testing.T) {
defer clearConfig()
defer clearRegistry("TestLogName")
for i, tc := range getFeedbackLogLevelTestCase() {
ctx := context.Background()
b := &bytes.Buffer{}
Expand Down Expand Up @@ -616,6 +618,8 @@ func TestLogWritesMessagesToFeedbackLog(t *testing.T) {
}

assert.Equal(t, logMessage+"\n", b.String())

clearRegistry("TestLogName")
}
}

Expand Down

0 comments on commit 0f54d22

Please sign in to comment.