summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-17 01:57:37 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-17 01:57:37 +0400
commitecbb684994263be9a2b3bdfe6899e847bce7d3fc (patch)
tree0987efb61668c366248a67310bad4fd70bbf6e5c
parente9ea74560023caf15a702a303bbd06237c879cb0 (diff)
UDP tracker RPC: test concurrent queries
-rw-r--r--bittorrent.cabal3
-rw-r--r--tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs8
2 files changed, 10 insertions, 1 deletions
diff --git a/bittorrent.cabal b/bittorrent.cabal
index e4752c13..a398dd6d 100644
--- a/bittorrent.cabal
+++ b/bittorrent.cabal
@@ -209,6 +209,9 @@ test-suite spec
209 System.Torrent.FileMapSpec 209 System.Torrent.FileMapSpec
210 build-depends: base == 4.* 210 build-depends: base == 4.*
211 211
212 -- * Concurrency
213 , async
214
212 -- * Data 215 -- * Data
213 , bytestring 216 , bytestring
214 , containers 217 , containers
diff --git a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
index fd7d1232..3ecc139d 100644
--- a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
@@ -1,6 +1,6 @@
1{-# LANGUAGE RecordWildCards #-} 1{-# LANGUAGE RecordWildCards #-}
2module Network.BitTorrent.Tracker.RPC.UDPSpec (spec, trackerURIs) where 2module Network.BitTorrent.Tracker.RPC.UDPSpec (spec, trackerURIs) where
3 3import Control.Concurrent.Async
4import Control.Monad 4import Control.Monad
5import Data.Default 5import Data.Default
6import Data.List as L 6import Data.List as L
@@ -47,3 +47,9 @@ spec = parallel $ do
47 withManager def $ \ mgr -> do 47 withManager def $ \ mgr -> do
48 xs <- scrape mgr uri [def] 48 xs <- scrape mgr uri [def]
49 L.length xs `shouldSatisfy` (>= 1) 49 L.length xs `shouldSatisfy` (>= 1)
50
51 describe "Manager" $ do
52 it "should handle arbitrary intermixed concurrent queries" $ do
53 withManager def $ \ mgr -> do
54 _ <- mapConcurrently (\ _ -> scrape mgr uri [def]) [1..100]
55 return () \ No newline at end of file