mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-22 19:19:42 +01:00
Upgrade nix grpc version to 1.0.1 + fix tests (#86)
* Use GRPC v1.01 (grpc-1.0.1-6040b47) * Minor tweaks to GRPC request result processing (less exact matching on some StatusDetails due to GRPC rev bump)
This commit is contained in:
parent
89a5547dc0
commit
24681a619b
3 changed files with 12 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
function purge_grpc {
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "grpc-${version}";
|
||||
version = "0.15-${lib.strings.substring 0 7 rev}";
|
||||
rev = "03efbd34ce64615f58007eae667b375accc6c8e6";
|
||||
version = "1.0.1-${lib.strings.substring 0 7 rev}";
|
||||
rev = "6040b471bcd1d6bb05b25c126b6545180a1d3528";
|
||||
src = fetchgit {
|
||||
inherit rev;
|
||||
url = "https://github.com/grpc/grpc.git";
|
||||
sha256 = "0a48swsip09bd0yk80gl9r7pny9dal3byyd22bdz4fcvydna43m0";
|
||||
sha256 = "1kx6jkx2dnnfnjfyc50ravfk7mfdszj988vndrlzs1zkd6627k4z";
|
||||
};
|
||||
preInstall = "export prefix";
|
||||
buildInputs =
|
||||
|
|
|
@ -244,9 +244,7 @@ testAuthMetadataTransfer =
|
|||
let authCtx = (channelAuthContext authMetaCtx)
|
||||
|
||||
addAuthProperty authCtx (AuthProperty "foo1" "bar1")
|
||||
print "getting properties"
|
||||
newProps <- getAuthProperties authCtx
|
||||
print "got properties"
|
||||
let addedProp = find ((== "foo1") . authPropName) newProps
|
||||
addedProp @?= Just (AuthProperty "foo1" "bar1")
|
||||
return $ ClientMetadataCreateResult [("foo","bar")] StatusOk ""
|
||||
|
@ -620,13 +618,13 @@ testGoaway =
|
|||
rm <- clientRegisterMethodNormal c "/foo"
|
||||
clientRequest c rm 10 "" mempty
|
||||
clientRequest c rm 10 "" mempty
|
||||
lastResult <- clientRequest c rm 1 "" mempty
|
||||
assertBool "Client handles server shutdown gracefully" $
|
||||
lastResult == badStatus StatusUnavailable
|
||||
||
|
||||
lastResult == badStatus StatusDeadlineExceeded
|
||||
||
|
||||
lastResult == Left GRPCIOTimeout
|
||||
eer <- clientRequest c rm 1 "" mempty
|
||||
assertBool "Client handles server shutdown gracefully" $ case eer of
|
||||
Left (GRPCIOBadStatusCode StatusUnavailable _) -> True
|
||||
Left (GRPCIOBadStatusCode StatusDeadlineExceeded "Deadline Exceeded") -> True
|
||||
Left GRPCIOTimeout -> True
|
||||
_ -> False
|
||||
|
||||
server s = do
|
||||
let rm = head (normalMethods s)
|
||||
serverHandleNormalCall s rm mempty dummyHandler
|
||||
|
@ -640,7 +638,7 @@ testSlowServer =
|
|||
client c = do
|
||||
rm <- clientRegisterMethodNormal c "/foo"
|
||||
result <- clientRequest c rm 1 "" mempty
|
||||
result @?= badStatus StatusDeadlineExceeded
|
||||
result @?= Left (GRPCIOBadStatusCode StatusDeadlineExceeded "Deadline Exceeded")
|
||||
server s = do
|
||||
let rm = head (normalMethods s)
|
||||
serverHandleNormalCall s rm mempty $ \_ -> do
|
||||
|
@ -789,12 +787,6 @@ dummyResult' :: StatusDetails
|
|||
-> IO (ByteString, MetadataMap, StatusCode, StatusDetails)
|
||||
dummyResult' = return . (mempty, mempty, StatusOk, )
|
||||
|
||||
badStatus :: StatusCode -> Either GRPCIOError a
|
||||
badStatus st = Left . GRPCIOBadStatusCode st $ case st of
|
||||
StatusDeadlineExceeded -> "Deadline Exceeded"
|
||||
StatusCancelled -> "Received RST_STREAM err=8"
|
||||
_ -> mempty
|
||||
|
||||
nop :: Monad m => a -> m ()
|
||||
nop = const (return ())
|
||||
|
||||
|
|
Loading…
Reference in a new issue