From f532597ab8759ffa153a939fc04b1566d09725b1 Mon Sep 17 00:00:00 2001 From: James Liu Date: Wed, 14 Aug 2024 13:57:10 +1000 Subject: [PATCH] wip --- internal/backup/log_entry_test.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/internal/backup/log_entry_test.go b/internal/backup/log_entry_test.go index 018644cbb4..70dc1cf1cf 100644 --- a/internal/backup/log_entry_test.go +++ b/internal/backup/log_entry_test.go @@ -6,6 +6,7 @@ import ( "io/fs" "os" "path/filepath" + "runtime" "slices" "strings" "sync" @@ -31,8 +32,7 @@ type mockLogManager struct { acknowledged []storage.LSN finalLSN storage.LSN entryRootPath string - finishFunc func() - + finishFunc func(finalLSN storage.LSN, notifications []notification) sync.Mutex } @@ -68,7 +68,7 @@ func (lm *mockLogManager) AcknowledgeTransaction(_ storagemgr.LogConsumer, lsn s } if lsn == lm.finalLSN && len(lm.notifications) == 0 { - lm.finishFunc() + lm.finishFunc(lm.finalLSN, lm.notifications) } } @@ -290,7 +290,12 @@ func TestLogEntryArchiver(t *testing.T) { archiver: archiver, notifications: tc.notifications, finalLSN: tc.finalLSN, - finishFunc: wg.Done, + finishFunc: func(finalLSN storage.LSN, notifications []notification) { + fmt.Println(runtime.StartTrace()) + fmt.Printf("finalLSN: %q\n", finalLSN) + fmt.Printf("notifications: %v\n", notifications) + wg.Done() + }, } managers[info] = manager @@ -411,8 +416,13 @@ func TestLogEntryArchiver_retry(t *testing.T) { highWaterMark: 1, }, }, - finalLSN: 1, - finishFunc: wg.Done, + finalLSN: 1, + finishFunc: func(finalLSN storage.LSN, notifications []notification) { + fmt.Println(runtime.StartTrace()) + fmt.Printf("finalLSN: %q\n", finalLSN) + fmt.Printf("notifications: %v\n", notifications) + wg.Done() + }, } accessor.Lock() -- GitLab