diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Network/KRPCSpec.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/Network/KRPCSpec.hs b/tests/Network/KRPCSpec.hs index 7f5b2794..e73b1ec0 100644 --- a/tests/Network/KRPCSpec.hs +++ b/tests/Network/KRPCSpec.hs | |||
@@ -20,18 +20,21 @@ handlers = | |||
20 | instance MonadLogger IO where | 20 | instance MonadLogger IO where |
21 | monadLoggerLog _ _ _ _ = return () | 21 | monadLoggerLog _ _ _ _ = return () |
22 | 22 | ||
23 | opts :: Options | ||
24 | opts = def { optQueryTimeout = 1 } | ||
25 | |||
23 | spec :: Spec | 26 | spec :: Spec |
24 | spec = do | 27 | spec = do |
25 | describe "query" $ do | 28 | describe "query" $ do |
26 | it "run handlers" $ do | 29 | it "run handlers" $ do |
27 | let int = 0xabcd :: Int | 30 | let int = 0xabcd :: Int |
28 | (withManager servAddr handlers $ runReaderT $ do | 31 | (withManager opts servAddr handlers $ runReaderT $ do |
29 | listen | 32 | listen |
30 | query servAddr (Echo int)) | 33 | query servAddr (Echo int)) |
31 | `shouldReturn` Echo int | 34 | `shouldReturn` Echo int |
32 | 35 | ||
33 | it "throw timeout exception" $ do | 36 | it "throw timeout exception" $ do |
34 | (withManager servAddr handlers $ runReaderT $ do | 37 | (withManager opts servAddr handlers $ runReaderT $ do |
35 | query servAddr (Echo (0xabcd :: Int)) | 38 | query servAddr (Echo (0xabcd :: Int)) |
36 | ) | 39 | ) |
37 | `shouldThrow` (== KError GenericError "timeout expired" "0") | 40 | `shouldThrow` (== KError GenericError "timeout expired" "0") |