MCPcopy
hub / github.com/natefinch/lumberjack / TestFirstWriteRotate

Function TestFirstWriteRotate

lumberjack_test.go:165–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

163}
164
165func TestFirstWriteRotate(t *testing.T) {
166 currentTime = fakeTime
167 megabyte = 1
168 dir := makeTempDir("TestFirstWriteRotate", t)
169 defer os.RemoveAll(dir)
170
171 filename := logFile(dir)
172 l := &Logger{
173 Filename: filename,
174 MaxSize: 10,
175 }
176 defer l.Close()
177
178 start := []byte("boooooo!")
179 err := ioutil.WriteFile(filename, start, 0600)
180 isNil(err, t)
181
182 newFakeTime()
183
184 // this would make us rotate
185 b := []byte("fooo!")
186 n, err := l.Write(b)
187 isNil(err, t)
188 equals(len(b), n, t)
189
190 existsWithContent(filename, b, t)
191 existsWithContent(backupFile(dir), start, t)
192
193 fileCount(dir, 2, t)
194}
195
196func TestMaxBackups(t *testing.T) {
197 currentTime = fakeTime

Callers

nothing calls this directly

Calls 10

CloseMethod · 0.95
WriteMethod · 0.95
makeTempDirFunction · 0.85
logFileFunction · 0.85
isNilFunction · 0.85
newFakeTimeFunction · 0.85
equalsFunction · 0.85
existsWithContentFunction · 0.85
backupFileFunction · 0.85
fileCountFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…