Skip to content

Commit

Permalink
Address race condition during tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Sep 21, 2024
1 parent bff8e0e commit 6ab68d4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions testing/logger/capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,15 @@ func (c *LogCapture) AssertHasEntry(t *testing.T, msg string) {

// Entries returns all log entries.
func (c *LogCapture) Entries() []string {
c.mu.Lock()
defer c.mu.Unlock()

return c.entries
}

// ClearEntries removes all log entries.
func (c *LogCapture) ClearEntries() {
c.mu.Lock()
c.entries = make([]string, 0)
c.mu.Unlock()
}

0 comments on commit 6ab68d4

Please sign in to comment.