diff options
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs index c406aabd..598b2866 100644 --- a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs +++ b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs | |||
@@ -97,35 +97,35 @@ spec = parallel $ do | |||
97 | scrape mgr (trackerURI badTracker) [def] `shouldThrow` isSomeException | 97 | scrape mgr (trackerURI badTracker) [def] `shouldThrow` isSomeException |
98 | 98 | ||
99 | describe "RPC" $ do | 99 | describe "RPC" $ do |
100 | forM_ (L.filter isUdpTracker trackers) $ \ TrackerEntry {..} -> | 100 | forM_ (L.filter isUdpTracker trackers) $ \ TrackerEntry {..} -> |
101 | context trackerName $ do | 101 | context trackerName $ do |
102 | 102 | ||
103 | describe "announce" $ do | 103 | describe "announce" $ do |
104 | if tryAnnounce then do | 104 | if tryAnnounce then do |
105 | it "have valid response" $ do | 105 | it "have valid response" $ do |
106 | withManager rpcOpts $ \ mgr -> do | 106 | withManager rpcOpts $ \ mgr -> do |
107 | q <- arbitrarySample | 107 | q <- arbitrarySample |
108 | announce mgr trackerURI q >>= validateInfo q | 108 | announce mgr trackerURI q >>= validateInfo q |
109 | else do | 109 | else do |
110 | it "should throw TimeoutExpired" $ do | 110 | it "should throw TimeoutExpired" $ do |
111 | withManager rpcOpts $ \ mgr -> do | 111 | withManager rpcOpts $ \ mgr -> do |
112 | q <- arbitrarySample | 112 | q <- arbitrarySample |
113 | announce mgr trackerURI q `shouldThrow` isTimeoutExpired | 113 | announce mgr trackerURI q `shouldThrow` isTimeoutExpired |
114 | 114 | ||
115 | describe "scrape" $ do | 115 | describe "scrape" $ do |
116 | if tryScraping then do | 116 | if tryScraping then do |
117 | it "have valid response" $ do | 117 | it "have valid response" $ do |
118 | withManager rpcOpts $ \ mgr -> do | 118 | withManager rpcOpts $ \ mgr -> do |
119 | xs <- scrape mgr trackerURI [def] | 119 | xs <- scrape mgr trackerURI [def] |
120 | L.length xs `shouldSatisfy` (>= 1) | 120 | L.length xs `shouldSatisfy` (>= 1) |
121 | else do | 121 | else do |
122 | it "should throw TimeoutExpired" $ do | 122 | it "should throw TimeoutExpired" $ do |
123 | withManager rpcOpts $ \ mgr -> do | 123 | withManager rpcOpts $ \ mgr -> do |
124 | scrape mgr trackerURI [def] `shouldThrow` isTimeoutExpired | 124 | scrape mgr trackerURI [def] `shouldThrow` isTimeoutExpired |
125 | 125 | ||
126 | describe "Manager" $ do | 126 | describe "Manager" $ do |
127 | when tryScraping $ do | 127 | when tryScraping $ do |
128 | it "should handle arbitrary intermixed concurrent queries" $ do | 128 | it "should handle arbitrary intermixed concurrent queries" $ do |
129 | withManager rpcOpts $ \ mgr -> do | 129 | withManager rpcOpts $ \ mgr -> do |
130 | _ <- mapConcurrently (\ _ -> scrape mgr trackerURI [def]) [1..rpcCount] | 130 | _ <- mapConcurrently (\ _ -> scrape mgr trackerURI [def]) [1..rpcCount] |
131 | return () \ No newline at end of file | 131 | return () \ No newline at end of file |