mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 03:18:55 +00:00
Add more debug logging to TestLockSuccessfulRefresh
The test fails from time to time. Add some more logging to hopefully get an idea where things go wrong.
This commit is contained in:
parent
57d8eedb88
commit
6b5d6b9f2c
@ -129,11 +129,26 @@ func TestLockFailedRefresh(t *testing.T) {
|
|||||||
unlockRepo(lock)
|
unlockRepo(lock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type loggingBackend struct {
|
||||||
|
restic.Backend
|
||||||
|
t *testing.T
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *loggingBackend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error {
|
||||||
|
b.t.Logf("save %v @ %v", h, time.Now())
|
||||||
|
return b.Backend.Save(ctx, h, rd)
|
||||||
|
}
|
||||||
|
|
||||||
func TestLockSuccessfulRefresh(t *testing.T) {
|
func TestLockSuccessfulRefresh(t *testing.T) {
|
||||||
repo, cleanup, _ := openTestRepo(t, nil)
|
repo, cleanup, _ := openTestRepo(t, func(r restic.Backend) (restic.Backend, error) {
|
||||||
|
return &loggingBackend{
|
||||||
|
Backend: r,
|
||||||
|
t: t,
|
||||||
|
}, nil
|
||||||
|
})
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
t.Log("test for successful lock refresh")
|
t.Logf("test for successful lock refresh %v", time.Now())
|
||||||
// reduce locking intervals to be suitable for testing
|
// reduce locking intervals to be suitable for testing
|
||||||
ri, rt := refreshInterval, refreshabilityTimeout
|
ri, rt := refreshInterval, refreshabilityTimeout
|
||||||
refreshInterval = 40 * time.Millisecond
|
refreshInterval = 40 * time.Millisecond
|
||||||
|
Loading…
Reference in New Issue
Block a user