Group client and server tests together

This commit is contained in:
Joel Stanley 2016-06-08 10:48:28 -05:00
parent 48c9545fdb
commit 2119ef4b16

View file

@ -19,11 +19,11 @@ lowLevelTests :: TestTree
lowLevelTests = testGroup "Unit tests of low-level Haskell library" lowLevelTests = testGroup "Unit tests of low-level Haskell library"
[ testGRPCBracket [ testGRPCBracket
, testCompletionQueueCreateDestroy , testCompletionQueueCreateDestroy
, testServerCreateDestroy
, testClientCreateDestroy , testClientCreateDestroy
, testWithServerCall , testClientCall
, testWithClientCall
, testClientTimeoutNoServer , testClientTimeoutNoServer
, testServerCreateDestroy
, testServerCall
, testServerTimeoutNoClient , testServerTimeoutNoClient
-- , testWrongEndpoint -- , testWrongEndpoint
, testPayload , testPayload
@ -39,22 +39,12 @@ testCompletionQueueCreateDestroy =
testCase "Create/destroy CQ" $ withGRPC $ \g -> testCase "Create/destroy CQ" $ withGRPC $ \g ->
withCompletionQueue g nop withCompletionQueue g nop
testServerCreateDestroy :: TestTree
testServerCreateDestroy =
serverOnlyTest "start/stop" [] nop
testClientCreateDestroy :: TestTree testClientCreateDestroy :: TestTree
testClientCreateDestroy = testClientCreateDestroy =
clientOnlyTest "start/stop" nop clientOnlyTest "start/stop" nop
testWithServerCall :: TestTree testClientCall :: TestTree
testWithServerCall = testClientCall =
serverOnlyTest "create/destroy call" [] $ \s -> do
r <- withServerUnregCall s 1 $ const $ return $ Right ()
r @?= Left GRPCIOTimeout
testWithClientCall :: TestTree
testWithClientCall =
clientOnlyTest "create/destroy call" $ \c -> do clientOnlyTest "create/destroy call" $ \c -> do
r <- withClientCall c "foo" 10 $ const $ return $ Right () r <- withClientCall c "foo" 10 $ const $ return $ Right ()
r @?= Right () r @?= Right ()
@ -66,6 +56,16 @@ testClientTimeoutNoServer =
r <- clientRegisteredRequest c rm 1 "Hello" mempty r <- clientRegisteredRequest c rm 1 "Hello" mempty
r @?= Left GRPCIOTimeout 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 :: TestTree
testServerTimeoutNoClient = testServerTimeoutNoClient =
serverOnlyTest "wait timeout when client DNE" [("/foo", Normal)] $ \s -> do serverOnlyTest "wait timeout when client DNE" [("/foo", Normal)] $ \s -> do