Skip to content

Fix Test_Executor_captureContainerLogs race

Arran Walker requested to merge ajwalker/fix-capture-container-logs-race into main

What does this MR do?

Fixes race in Docker and Kubernetes' Test_Executor_captureContainerLogs test.

These tests were previously having the build log write to a buffer that was then periodically being read from. This underlying buffer isn't safe for concurrent use.

This changes the buffer to a trace.Buffer which conveniently allows us to read and write safely.

Why was this MR needed?

To avoid race.

What's the best way to test this MR?

go test -run Test_Executor_captureContainerLogs ./executors/docker -v -race
go test -run Test_Executor_captureContainerLogs ./executors/kubernetes -v -race

What are the relevant issue numbers?

#30835 (closed)

Edited by Arran Walker

Merge request reports