From e991a1ce53be2207a4933d20120826f4ba14ac95 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Wed, 13 Nov 2019 10:13:03 +1000 Subject: [PATCH 1/2] LoggingSpec: Add a missing pendingOnwindows --- lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs b/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs index 01fe819065b..f294c4a251c 100644 --- a/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs +++ b/lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs @@ -183,6 +183,7 @@ spec = describe "Logging Middleware" void $ mapConcurrently (const (get ctx "/get")) (replicate n ()) entries <- readTVarIO (logs ctx) let index = Map.fromList [ (loName l, l) | l <- entries ] + pendingOnWindows "Disabled on windows due to race with log flushing" Map.size index `shouldBe` n it "correct time measures" $ \ctx -> property $ \(nReq, ix) -> From 8937f69b2e28973cdae4e22de9e80cce293408f0 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Wed, 13 Nov 2019 10:19:53 +1000 Subject: [PATCH 2/2] Api.ServerSpec: Let tests pass on both Wine and Windows --- lib/core/src/Cardano/Wallet/Api/Server.hs | 5 +++-- lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/core/src/Cardano/Wallet/Api/Server.hs b/lib/core/src/Cardano/Wallet/Api/Server.hs index ab3a7c4d5d9..8f9e6418904 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -380,7 +380,7 @@ ioToListenError hostPreference portOpt e | isDoesNotExistError e = Just (ListenErrorHostDoesNotExist hostPreference) -- Bad hostname (bind: WSAEOPNOTSUPP) -- Windows - | isUserError e && hasDescription "10045" = + | isUserError e && (hasDescription "11001" || hasDescription "10045") = Just (ListenErrorHostDoesNotExist hostPreference) -- Address is valid, but can't be used for listening -- Linux | show (ioeGetErrorType e) == "invalid argument" = @@ -389,7 +389,8 @@ ioToListenError hostPreference portOpt e | show (ioeGetErrorType e) == "unsupported operation" = Just (ListenErrorInvalidAddress hostPreference) -- Address is valid, but can't be used for listening -- Windows - | isOtherError e && hasDescription "WSAEINVAL" = + | isOtherError e && + (hasDescription "WSAEINVAL" || hasDescription "WSAEADDRNOTAVAIL") = Just (ListenErrorInvalidAddress hostPreference) -- Listening on an unavailable or privileged port -- Windows | isOtherError e && hasDescription "WSAEACCESS" = diff --git a/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs b/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs index 2d7679747f7..4220d1b2ebc 100644 --- a/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs +++ b/lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs @@ -47,6 +47,7 @@ spec = describe "API Server" $ do res `shouldBe` Left ListenErrorOperationNotPermitted it "handles port in use" $ do + skipOnWindows "Windows permits listening on same port multiple times" withListeningSocket "127.0.0.1" ListenOnRandomPort $ \case Right (port, _) -> withListeningSocket "127.0.0.1" (ListenOnPort port) $ \res ->