Skip to content

Commit

Permalink
chore: fix race in integration test logWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Apr 30, 2024
1 parent 3a5ce4b commit 8816101
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions integration/harness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ func (i testContext) AssertWithRetry(t testing.TB, assertion action) {
type action func(t testing.TB, ic testContext) error

type logWriter struct {
mu sync.Mutex
logger interface{ Log(...any) }
buffer []byte
}

func (l *logWriter) Write(p []byte) (n int, err error) {
l.mu.Lock()
defer l.mu.Unlock()
for {
index := bytes.IndexByte(p, '\n')
if index == -1 {
Expand Down

0 comments on commit 8816101

Please sign in to comment.