diff options
Diffstat (limited to 'tests/Network')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs | 16 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Tracker/TestData.hs | 6 |
2 files changed, 16 insertions, 6 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 | ||
39 | isTimeoutExpired :: RpcException -> Bool | ||
40 | isTimeoutExpired (TimeoutExpired _) = True | ||
41 | isTimeoutExpired _ = False | ||
42 | |||
39 | spec :: Spec | 43 | spec :: Spec |
40 | spec = parallel $ do | 44 | spec = 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 |
diff --git a/tests/Network/BitTorrent/Tracker/TestData.hs b/tests/Network/BitTorrent/Tracker/TestData.hs index 85544b91..22077e90 100644 --- a/tests/Network/BitTorrent/Tracker/TestData.hs +++ b/tests/Network/BitTorrent/Tracker/TestData.hs | |||
@@ -72,7 +72,11 @@ notWorking name uri = (trackerEntry uri) | |||
72 | trackers :: [TrackerEntry] | 72 | trackers :: [TrackerEntry] |
73 | trackers = | 73 | trackers = |
74 | [ announceOnly "LinuxTracker" | 74 | [ announceOnly "LinuxTracker" |
75 | "http://linuxtracker.org:2710/00000000000000000000000000000000/announce" | 75 | "http://linuxtracker.org:2710/00000000000000000000000000000000/announce" |
76 | |||
77 | -- from "http://www.linux23.com/" | ||
78 | , announceScrape "Arch" "http://tracker.archlinux.org:6969/announce" | ||
79 | , notWorking "rarbg" "udp://9.rarbg.com:2710/announce" | ||
76 | 80 | ||
77 | , announceScrape "OpenBitTorrent" "udp://tracker.openbittorrent.com:80/announce" | 81 | , announceScrape "OpenBitTorrent" "udp://tracker.openbittorrent.com:80/announce" |
78 | , announceScrape "PublicBT" "udp://tracker.publicbt.com:80/announce" | 82 | , announceScrape "PublicBT" "udp://tracker.publicbt.com:80/announce" |