@@ -662,7 +662,6 @@ func TestPeerProtectionMultipleTags(t *testing.T) {
662662 t .Error ("protected connection was closed by connection manager" )
663663 }
664664 }
665-
666665}
667666
668667func TestPeerProtectionIdempotent (t * testing.T ) {
@@ -835,15 +834,15 @@ func TestPeerInfoSorting(t *testing.T) {
835834 p2 := & peerInfo {id : peer .ID ("peer2" ), temp : true }
836835 pis := peerInfos {p1 , p2 }
837836 pis .SortByValueAndStreams (makeSegmentsWithPeerInfos (pis ), false )
838- require .Equal (t , pis , peerInfos {p2 , p1 })
837+ require .Equal (t , peerInfos {p2 , p1 }, pis )
839838 })
840839
841840 t .Run ("starts with low-value connections" , func (t * testing.T ) {
842841 p1 := & peerInfo {id : peer .ID ("peer1" ), value : 40 }
843842 p2 := & peerInfo {id : peer .ID ("peer2" ), value : 20 }
844843 pis := peerInfos {p1 , p2 }
845844 pis .SortByValueAndStreams (makeSegmentsWithPeerInfos (pis ), false )
846- require .Equal (t , pis , peerInfos {p2 , p1 })
845+ require .Equal (t , peerInfos {p2 , p1 }, pis )
847846 })
848847
849848 t .Run ("prefer peers with no streams" , func (t * testing.T ) {
@@ -859,7 +858,7 @@ func TestPeerInfoSorting(t *testing.T) {
859858 }
860859 pis := peerInfos {p2 , p1 }
861860 pis .SortByValueAndStreams (makeSegmentsWithPeerInfos (pis ), false )
862- require .Equal (t , pis , peerInfos {p1 , p2 })
861+ require .Equal (t , peerInfos {p1 , p2 }, pis )
863862 })
864863
865864 t .Run ("in a memory emergency, starts with incoming connections and higher streams" , func (t * testing.T ) {
@@ -902,7 +901,7 @@ func TestPeerInfoSorting(t *testing.T) {
902901 // p3 is first because it is inactive (no streams).
903902 // p4 is second because it has the most streams and we priortize killing
904903 // connections with the higher number of streams.
905- require .Equal (t , pis , peerInfos {p3 , p4 , p2 , p1 })
904+ require .Equal (t , peerInfos {p3 , p4 , p2 , p1 }, pis )
906905 })
907906
908907 t .Run ("in a memory emergency, starts with connections that have many streams" , func (t * testing.T ) {
@@ -921,7 +920,7 @@ func TestPeerInfoSorting(t *testing.T) {
921920 }
922921 pis := peerInfos {p1 , p2 }
923922 pis .SortByValueAndStreams (makeSegmentsWithPeerInfos (pis ), true )
924- require .Equal (t , pis , peerInfos {p2 , p1 })
923+ require .Equal (t , peerInfos {p2 , p1 }, pis )
925924 })
926925}
927926
0 commit comments