From 8712ab110d4e64eb43bff457e98aea28a1a90d73 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 3 May 2018 20:49:15 -0700 Subject: [PATCH] test: fix revocation integration test flake In this commit, we fix an existing flake within the set of revocation integration tests. Right after Bob's restart, we attempt to force close the channel. However, it may be the case that the chain arbitrator hasn't yet been created. As a result, the request to force close the channel will fail. We easily fix this by wrapping the force close attempt in a WaitPredicate. --- lnd_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index f1f38035..07e95f3a 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -4205,10 +4205,19 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) { // broadcasting his current channel state. This is actually the // commitment transaction of a prior *revoked* state, so he'll soon // feel the wrath of Alice's retribution. + var closeUpdates lnrpc.Lightning_CloseChannelClient force := true - closeUpdates, _, err := net.CloseChannel(ctxb, net.Bob, chanPoint, force) + err = lntest.WaitPredicate(func() bool { + closeUpdates, _, err = net.CloseChannel(ctxb, net.Bob, chanPoint, force) + if err != nil { + predErr = err + return false + } + + return true + }, time.Second*10) if err != nil { - t.Fatalf("unable to close channel: %v", err) + t.Fatalf("unable to close channel: %v", predErr) } // Wait for Bob's breach transaction to show up in the mempool to ensure