Skip to content

Commit

Permalink
Race
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jan 2, 2022
1 parent 8f24197 commit ef70c3b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion hugolib/integrationtest_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,23 @@ type IntegrationTestBuilder struct {

buildCount int
counters *testCounters
logBuff bytes.Buffer
logBuff lockingBuffer

builderInit sync.Once
}

type lockingBuffer struct {
sync.Mutex
bytes.Buffer
}

func (b *lockingBuffer) Write(p []byte) (n int, err error) {
b.Lock()
n, err = b.Buffer.Write(p)
b.Unlock()
return
}

func (s *IntegrationTestBuilder) AssertLogContains(text string) {
s.Helper()
s.Assert(s.logBuff.String(), qt.Contains, text)
Expand Down

0 comments on commit ef70c3b

Please sign in to comment.