summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/Tracker/RPC
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/RPC')
-rw-r--r--tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
index 57680a5b..acc60e09 100644
--- a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
@@ -36,6 +36,10 @@ rpcOpts = def
36 , optMaxTimeout = 10 36 , optMaxTimeout = 10
37 } 37 }
38 38
39isTimeoutExpired :: RpcException -> Bool
40isTimeoutExpired (TimeoutExpired _) = True
41isTimeoutExpired _ = False
42
39spec :: Spec 43spec :: Spec
40spec = parallel $ do 44spec = parallel $ do
41 forM_ (L.filter isUdpTracker trackers) $ \ TrackerEntry {..} -> 45 forM_ (L.filter isUdpTracker trackers) $ \ TrackerEntry {..} ->
@@ -48,8 +52,10 @@ spec = parallel $ do
48 q <- arbitrarySample 52 q <- arbitrarySample
49 announce mgr trackerURI q >>= validateInfo q 53 announce mgr trackerURI q >>= validateInfo q
50 else do 54 else do
51 it "should throw TrackerNotResponding" $ do 55 it "should throw TimeoutExpired" $ do
52 pending 56 withManager rpcOpts $ \ mgr -> do
57 q <- arbitrarySample
58 announce mgr trackerURI q `shouldThrow` isTimeoutExpired
53 59
54 describe "scrape" $ do 60 describe "scrape" $ do
55 if tryScraping then do 61 if tryScraping then do
@@ -58,9 +64,9 @@ spec = parallel $ do
58 xs <- scrape mgr trackerURI [def] 64 xs <- scrape mgr trackerURI [def]
59 L.length xs `shouldSatisfy` (>= 1) 65 L.length xs `shouldSatisfy` (>= 1)
60 else do 66 else do
61 it "should throw TrackerNotResponding" $ do 67 it "should throw TimeoutExpired" $ do
62 pending 68 withManager rpcOpts $ \ mgr -> do
63 69 scrape mgr trackerURI [def] `shouldThrow` isTimeoutExpired
64 70
65 describe "Manager" $ do 71 describe "Manager" $ do
66 when tryScraping $ do 72 when tryScraping $ do