From 1fed2234833aa49ff728474208a65cbc23682ee4 Mon Sep 17 00:00:00 2001
From: Marius van der Wijden <m.vanderwijden@live.de>
Date: Tue, 13 Oct 2020 19:46:43 +0200
Subject: [PATCH] accounts/keystore: fix flaky test (#21703)

* accounts/keystore: add timeout to test to prevent failure on travis

The TestWalletNotifications test sporadically fails on travis.
This is because we shutdown the event collection before all events are received.
Adding a small timeout (10 milliseconds) allows the collector to be scheduled
and to consume all pending events before we shut it down.

* accounts/keystore: added newlines back in

* accounts/keystore: properly fix the walletNotifications test
---
 accounts/keystore/keystore_test.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/accounts/keystore/keystore_test.go b/accounts/keystore/keystore_test.go
index 29c251d7c..cb5de11c0 100644
--- a/accounts/keystore/keystore_test.go
+++ b/accounts/keystore/keystore_test.go
@@ -336,7 +336,9 @@ func TestWalletNotifications(t *testing.T) {
 
 	// Shut down the event collector and check events.
 	sub.Unsubscribe()
-	<-updates
+	for ev := range updates {
+		events = append(events, walletEvent{ev, ev.Wallet.Accounts()[0]})
+	}
 	checkAccounts(t, live, ks.Wallets())
 	checkEvents(t, wantEvents, events)
 }
-- 
GitLab