Exemplo n.º 1
0
func printOnFailure(t *testing.T, lru *TieredLRUCache) {
	if t.Failed() {
		printMockLogger(t, lru.logger.(*mock.Logger))
	}
	if str := recover(); str != nil {
		printLru(lru)
		printMockLogger(t, lru.logger.(*mock.Logger))
		panic(utils.WrapErrorWithStack(str.(error)).Error())
	}
}
Exemplo n.º 2
0
func (pw *partWriter) Close() error {
	if pw.currentPos-pw.startPos != pw.length {
		return utils.WrapErrorWithStack(&partWriterShortWrite{
			expected: pw.length,
			actual:   pw.currentPos - pw.startPos,
		})
	}
	if pw.buf == nil {
		return nil
	}
	return pw.flushBuffer()
}