From: Matt Joiner Date: Fri, 17 Apr 2020 01:40:03 +0000 (+1000) Subject: Fix transfer test check for seeder piece counts X-Git-Tag: v1.16.0~66 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=013fa1df5a5d4bcf3aa66f490d06ffb1c80fb036;p=btrtrc.git Fix transfer test check for seeder piece counts I suspect that there's a race where a connection is established to the seeder, but we haven't received it's completed piece information yet, and we already finished reading all the data we need from another connection. Probably comes up now because pending peers with the same address aren't clobbering each other since that was fixed. --- diff --git a/test/transfer_test.go b/test/transfer_test.go index 30402793..d3ec5ff8 100644 --- a/test/transfer_test.go +++ b/test/transfer_test.go @@ -134,8 +134,16 @@ func testClientTransfer(t *testing.T, ps testClientTransferParams) { assert.NotEmpty(t, seederTorrent.PeerConns()) leecherPeerConns := leecherTorrent.PeerConns() assert.NotEmpty(t, leecherPeerConns) + foundSeeder := false for _, pc := range leecherPeerConns { - assert.EqualValues(t, leecherTorrent.Info().NumPieces(), pc.PeerPieces().Len()) + completed := pc.PeerPieces().Len() + t.Logf("peer conn %v has %v completed pieces", pc, completed) + if completed == leecherTorrent.Info().NumPieces() { + foundSeeder = true + } + } + if !foundSeeder { + t.Errorf("didn't find seeder amongst leecher peer conns") } seederStats := seederTorrent.Stats()