MCPcopy
hub / github.com/google/mtail / TestOpenFile

Function TestOpenFile

internal/testutil/fs.go:28–35  ·  view source on GitHub ↗

TestOpenFile creates a new file called name and returns the opened file.

(tb testing.TB, name string)

Source from the content-addressed store, hash-verified

26
27// TestOpenFile creates a new file called name and returns the opened file.
28func TestOpenFile(tb testing.TB, name string) *os.File {
29 tb.Helper()
30 f, err := os.OpenFile(filepath.Clean(name), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600)
31 if err != nil {
32 tb.Fatal(err)
33 }
34 return f
35}
36
37// OpenLogFile creates a new file that emulates being a log.
38func OpenLogFile(tb testing.TB, name string) *os.File {

Callers 15

TestPollLogPathPatternsFunction · 0.92
TestLogTruncationFunction · 0.92
TestLogRotationByRenameFunction · 0.92
TestGlobBeforeStartFunction · 0.92
TestGlobAfterStartFunction · 0.92
BenchmarkProgramFunction · 0.92
TestBasicTailFunction · 0.92
TestLogDeletionFunction · 0.92
TestNewProgFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected