From ecbb684994263be9a2b3bdfe6899e847bce7d3fc Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Mon, 17 Feb 2014 01:57:37 +0400 Subject: UDP tracker RPC: test concurrent queries --- bittorrent.cabal | 3 +++ tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 System.Torrent.FileMapSpec build-depends: base == 4.* + -- * Concurrency + , async + -- * Data , bytestring , 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 @@ {-# LANGUAGE RecordWildCards #-} module Network.BitTorrent.Tracker.RPC.UDPSpec (spec, trackerURIs) where - +import Control.Concurrent.Async import Control.Monad import Data.Default import Data.List as L @@ -47,3 +47,9 @@ spec = parallel $ do withManager def $ \ mgr -> do xs <- scrape mgr uri [def] L.length xs `shouldSatisfy` (>= 1) + + describe "Manager" $ do + it "should handle arbitrary intermixed concurrent queries" $ do + withManager def $ \ mgr -> do + _ <- mapConcurrently (\ _ -> scrape mgr uri [def]) [1..100] + return () \ No newline at end of file -- cgit v1.2.3