Skip to content

testhelper: Fix race condition on test logger buf

Will Chandler (ex-GitLab) requested to merge wc/fix-testlogger-race into master

Currently we supply a bare bytes.Buffer to logrus for use as output. When a test fails, we read the contents of the buffer, but do so without synchronization with logrus's goroutines, causing race detector failures.

Add a new syncBuffer struct to synchronize access. For now keep this private to testhelper until we see other uses for it.

Edited by Will Chandler (ex-GitLab)

Merge request reports