Merge branch 'master' into feature-wait-for-unlock
This commit is contained in:
commit
1f43003cc1
1 changed files with 13 additions and 2 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -138,7 +139,9 @@ type loggingBackend struct {
|
||||||
|
|
||||||
func (b *loggingBackend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error {
|
func (b *loggingBackend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error {
|
||||||
b.t.Logf("save %v @ %v", h, time.Now())
|
b.t.Logf("save %v @ %v", h, time.Now())
|
||||||
return b.Backend.Save(ctx, h, rd)
|
err := b.Backend.Save(ctx, h, rd)
|
||||||
|
b.t.Logf("save finished %v @ %v", h, time.Now())
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLockSuccessfulRefresh(t *testing.T) {
|
func TestLockSuccessfulRefresh(t *testing.T) {
|
||||||
|
@ -163,7 +166,15 @@ func TestLockSuccessfulRefresh(t *testing.T) {
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-wrappedCtx.Done():
|
case <-wrappedCtx.Done():
|
||||||
t.Fatal("lock refresh failed")
|
// don't call t.Fatal to allow the lock to be properly cleaned up
|
||||||
|
t.Error("lock refresh failed", time.Now())
|
||||||
|
|
||||||
|
// Dump full stacktrace
|
||||||
|
buf := make([]byte, 1024*1024)
|
||||||
|
n := runtime.Stack(buf, true)
|
||||||
|
buf = buf[:n]
|
||||||
|
t.Log(string(buf))
|
||||||
|
|
||||||
case <-time.After(2 * refreshabilityTimeout):
|
case <-time.After(2 * refreshabilityTimeout):
|
||||||
// expected lock refresh to work
|
// expected lock refresh to work
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue