MCPcopy
hub / github.com/grafana/dskit / outFile

Function outFile

log/buffered_test.go:135–140  ·  view source on GitHub ↗

outFile creates a real OS file for testing. We cannot use stdout/stderr since we need to read the contents afterwards to validate, and we have to write to a file to benchmark the impact of write() syscalls.

(b *testing.B)

Source from the content-addressed store, hash-verified

133// We cannot use stdout/stderr since we need to read the contents afterwards to validate, and we have to write to a file
134// to benchmark the impact of write() syscalls.
135func outFile(b *testing.B) *os.File {
136 f, err := os.CreateTemp(b.TempDir(), "buffered*")
137 require.NoErrorf(b, err, "cannot create test file")
138
139 return f
140}
141
142// Copied from go-kit/log
143// These tests are designed to be run with the race detector.

Callers 2

BenchmarkBufferedFunction · 0.85
BenchmarkUnbufferedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected