lnd_test: use WaitNoError when testing num singles in...
export_channel_backup. Fixes a local flake hit reliably on darwin.
This commit is contained in:
parent
58aa32035c
commit
f19a6a0ba2
39
lnd_test.go
39
lnd_test.go
@ -13378,21 +13378,32 @@ func testExportChannelBackup(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// Before we proceed, we'll make two utility methods we'll use below
|
// Before we proceed, we'll make two utility methods we'll use below
|
||||||
// for our primary assertions.
|
// for our primary assertions.
|
||||||
assertNumSingleBackups := func(numSingles int) {
|
assertNumSingleBackups := func(numSingles int) {
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
err := lntest.WaitNoError(func() error {
|
||||||
req := &lnrpc.ChanBackupExportRequest{}
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
chanSnapshot, err := carol.ExportAllChannelBackups(ctxt, req)
|
req := &lnrpc.ChanBackupExportRequest{}
|
||||||
|
chanSnapshot, err := carol.ExportAllChannelBackups(
|
||||||
|
ctxt, req,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to export channel "+
|
||||||
|
"backup: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if chanSnapshot.SingleChanBackups == nil {
|
||||||
|
return fmt.Errorf("single chan backups not " +
|
||||||
|
"populated")
|
||||||
|
}
|
||||||
|
|
||||||
|
backups := chanSnapshot.SingleChanBackups.ChanBackups
|
||||||
|
if len(backups) != numSingles {
|
||||||
|
return fmt.Errorf("expected %v singles, "+
|
||||||
|
"got %v", len(backups), numSingles)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}, defaultTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to export channel backup: %v", err)
|
t.Fatalf(err.Error())
|
||||||
}
|
|
||||||
|
|
||||||
if chanSnapshot.SingleChanBackups == nil {
|
|
||||||
t.Fatalf("single chan backups not populated")
|
|
||||||
}
|
|
||||||
|
|
||||||
backups := chanSnapshot.SingleChanBackups.ChanBackups
|
|
||||||
if len(backups) != numSingles {
|
|
||||||
t.Fatalf("expected %v singles, got %v", len(backups),
|
|
||||||
numSingles)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertMultiBackupFound := func() func(bool, map[wire.OutPoint]struct{}) {
|
assertMultiBackupFound := func() func(bool, map[wire.OutPoint]struct{}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user