MCPcopy
hub / github.com/git-lfs/git-lfs / TestLoggerLogsAllDurableUpdates

Function TestLoggerLogsAllDurableUpdates

tasklog/log_test.go:174–196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

172}
173
174func TestLoggerLogsAllDurableUpdates(t *testing.T) {
175 var buf bytes.Buffer
176
177 l := NewLogger(&buf, ForceProgress(true))
178 l.widthFn = func() int { return 0 }
179 l.throttle = 15 * time.Minute
180
181 t1 := make(chan *Update)
182 go func() {
183 t1 <- &Update{"first", time.Now(), false} // t = 0+ε ms, throttle is open
184 t1 <- &Update{"second", time.Now(), false} // t = 0+2ε ms, throttle is closed
185 close(t1) // t = 0+3ε ms, throttle is closed
186 }()
187
188 l.Enqueue(UnthrottledChanTask(t1))
189 l.Close()
190
191 assert.Equal(t, strings.Join([]string{
192 "first\r",
193 "second\r",
194 "second, done.\n",
195 }, ""), buf.String())
196}
197
198func TestLoggerHandlesSilentTasks(t *testing.T) {
199 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 7

EnqueueMethod · 0.95
CloseMethod · 0.95
NewLoggerFunction · 0.85
ForceProgressFunction · 0.85
UnthrottledChanTaskTypeAlias · 0.85
StringMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected