itest: wait for file writing in wait predicate

This commit is contained in:
Johan T. Halseth 2020-03-24 12:18:42 +01:00
parent 8623bfac22
commit 8dc5a3c144
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

View File

@ -12717,12 +12717,16 @@ func testAbandonChannel(net *lntest.NetworkHarness, t *harnessTest) {
}
// Make sure the channel is no longer in the channel backup list.
bkupAfter, err := ioutil.ReadFile(net.Alice.ChanBackupPath())
err = wait.Predicate(func() bool {
bkupAfter, err := ioutil.ReadFile(net.Alice.ChanBackupPath())
if err != nil {
t.Fatalf("could not get channel backup before "+
"abandoning channel: %v", err)
}
return len(bkupAfter) < len(bkupBefore)
}, defaultTimeout)
if err != nil {
t.Fatalf("could not get channel backup before abandoning "+
"channel: %v", err)
}
if len(bkupAfter) >= len(bkupBefore) {
t.Fatalf("channel wasn't removed from channel backup file")
}