2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-23 05:12:10 +00:00

lock: Print stacktrace if TestLockSuccessfulRefresh fails

This commit is contained in:
Michael Eischer 2023-04-07 19:51:31 +02:00
parent 64233ca0a7
commit cf1cc1fb72

View File

@ -3,6 +3,7 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"runtime"
"testing" "testing"
"time" "time"
@ -165,6 +166,13 @@ func TestLockSuccessfulRefresh(t *testing.T) {
case <-wrappedCtx.Done(): case <-wrappedCtx.Done():
// don't call t.Fatal to allow the lock to be properly cleaned up // don't call t.Fatal to allow the lock to be properly cleaned up
t.Error("lock refresh failed", time.Now()) 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
} }