From c9187bf736a626f0388cbace46c80911bc78384b Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 13 Jun 2018 22:02:30 +1000 Subject: [PATCH] Update some tests now that adding connections is more reliable --- client_test.go | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/client_test.go b/client_test.go index 63bcd663..4d9c56ca 100644 --- a/client_test.go +++ b/client_test.go @@ -498,17 +498,8 @@ func TestSeedAfterDownloading(t *testing.T) { }() done := make(chan struct{}) defer close(done) - go func() { - for { - go leecherGreeting.AddClientPeer(seeder) - go leecherGreeting.AddClientPeer(leecherLeecher) - select { - case <-done: - return - case <-time.After(time.Second): - } - } - }() + go leecherGreeting.AddClientPeer(seeder) + go leecherGreeting.AddClientPeer(leecherLeecher) wg.Add(1) go func() { defer wg.Done() @@ -860,16 +851,7 @@ func testDownloadCancel(t *testing.T, ps testDownloadCancelParams) { leecherGreeting.cl.mu.Unlock() done := make(chan struct{}) defer close(done) - go func() { - for { - leecherGreeting.AddClientPeer(seeder) - select { - case <-done: - return - case <-time.After(time.Second): - } - } - }() + go leecherGreeting.AddClientPeer(seeder) completes := make(map[int]bool, 3) expected := func() map[int]bool { if ps.Cancel {