From 2119ef4b168b1bcf735d8a638a115a425f14d82c Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Wed, 8 Jun 2016 10:48:28 -0500 Subject: [PATCH] Group client and server tests together --- tests/LowLevelTests.hs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/LowLevelTests.hs b/tests/LowLevelTests.hs index d2d5d90..361bf33 100644 --- a/tests/LowLevelTests.hs +++ b/tests/LowLevelTests.hs @@ -19,11 +19,11 @@ lowLevelTests :: TestTree lowLevelTests = testGroup "Unit tests of low-level Haskell library" [ testGRPCBracket , testCompletionQueueCreateDestroy - , testServerCreateDestroy , testClientCreateDestroy - , testWithServerCall - , testWithClientCall + , testClientCall , testClientTimeoutNoServer + , testServerCreateDestroy + , testServerCall , testServerTimeoutNoClient -- , testWrongEndpoint , testPayload @@ -39,22 +39,12 @@ testCompletionQueueCreateDestroy = testCase "Create/destroy CQ" $ withGRPC $ \g -> withCompletionQueue g nop -testServerCreateDestroy :: TestTree -testServerCreateDestroy = - serverOnlyTest "start/stop" [] nop - testClientCreateDestroy :: TestTree testClientCreateDestroy = clientOnlyTest "start/stop" nop -testWithServerCall :: TestTree -testWithServerCall = - serverOnlyTest "create/destroy call" [] $ \s -> do - r <- withServerUnregCall s 1 $ const $ return $ Right () - r @?= Left GRPCIOTimeout - -testWithClientCall :: TestTree -testWithClientCall = +testClientCall :: TestTree +testClientCall = clientOnlyTest "create/destroy call" $ \c -> do r <- withClientCall c "foo" 10 $ const $ return $ Right () r @?= Right () @@ -66,6 +56,16 @@ testClientTimeoutNoServer = r <- clientRegisteredRequest c rm 1 "Hello" mempty r @?= Left GRPCIOTimeout +testServerCreateDestroy :: TestTree +testServerCreateDestroy = + serverOnlyTest "start/stop" [] nop + +testServerCall :: TestTree +testServerCall = + serverOnlyTest "create/destroy call" [] $ \s -> do + r <- withServerUnregCall s 1 $ const $ return $ Right () + r @?= Left GRPCIOTimeout + testServerTimeoutNoClient :: TestTree testServerTimeoutNoClient = serverOnlyTest "wait timeout when client DNE" [("/foo", Normal)] $ \s -> do