Fix tests

This commit is contained in:
Gabriel Gonzalez 2019-06-03 12:30:07 -07:00
parent 68ce43f183
commit dffd2d19f2
3 changed files with 6 additions and 5 deletions

View file

@ -13,6 +13,7 @@ mkDerivation {
transformers vector
];
librarySystemDepends = [ grpc ];
buildDepends = [ grpc ];
libraryToolDepends = [ c2hs ];
testHaskellDepends = [
async base bytestring clock containers managed pipes proto3-suite

View file

@ -34,7 +34,7 @@ import Test.Tasty
import Test.Tasty.HUnit ((@?=), assertString, testCase)
testNormalCall client = testCase "Normal call" $
do randoms <- fromList <$> replicateM 1000 (Fixed <$> randomRIO (1, 1000))
do randoms <- fromList <$> replicateM 1000 (randomRIO (1, 1000))
let req = SimpleServiceRequest "NormalRequest" randoms
res <- simpleServiceNormalCall client
(ClientNormalRequest req 10 mempty)
@ -52,7 +52,7 @@ testClientStreamingCall client = testCase "Client-streaming call" $
do (finalName, totalSum) <-
fmap ((mconcat *** (sum . mconcat)) . unzip) .
replicateM iterationCount $
do randoms <- fromList <$> replicateM 1000 (Fixed <$> randomRIO (1, 1000))
do randoms <- fromList <$> replicateM 1000 (randomRIO (1, 1000))
name <- fromString <$> replicateM 10 (randomRIO ('a', 'z'))
send (SimpleServiceRequest name randoms)
pure (name, randoms)
@ -69,7 +69,7 @@ testClientStreamingCall client = testCase "Client-streaming call" $
testServerStreamingCall client = testCase "Server-streaming call" $
do numCount <- randomRIO (50, 500)
nums <- replicateM numCount (Fixed <$> randomIO)
nums <- replicateM numCount (randomIO)
let checkResults [] recv =
do res <- recv
@ -98,7 +98,7 @@ testBiDiStreamingCall client = testCase "Bidi-streaming call" $
do let handleRequests (0 :: Int) _ _ done = done >> pure ()
handleRequests n recv send done =
do numCount <- randomRIO (10, 1000)
nums <- fromList <$> replicateM numCount (Fixed <$> randomRIO (1, 1000))
nums <- fromList <$> replicateM numCount (randomRIO (1, 1000))
testName <- fromString <$> replicateM 10 (randomRIO ('a', 'z'))
send (SimpleServiceRequest testName nums)

View file

@ -38,4 +38,4 @@ server = beta_create_SimpleService_server(SimpleServiceServer())
server.add_insecure_port('[::]:50051')
server.start()
done_queue.get()
done_queue.get(True, 10)