Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests passing on both Windows and Wine #1016

Merged
merged 2 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/core/src/Cardano/Wallet/Api/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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" =
Expand All @@ -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" =
Expand Down
1 change: 1 addition & 0 deletions lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What... ?

withListeningSocket "127.0.0.1" ListenOnRandomPort $ \case
Right (port, _) ->
withListeningSocket "127.0.0.1" (ListenOnPort port) $ \res ->
Expand Down
1 change: 1 addition & 0 deletions lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down