Skip to content

Commit

Permalink
integration tests: Set UTF-8 code page on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Nov 12, 2019
1 parent 2ecc806 commit 1bf3526
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/jormungandr/test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import Cardano.Faucet
( initFaucet )
import Cardano.Launcher
( ProcessHasExited (..) )
import Cardano.Launcher
( withUtf8Encoding )
import Cardano.Wallet.Api.Server
( Listen (..) )
import Cardano.Wallet.Jormungandr
Expand Down Expand Up @@ -52,8 +54,6 @@ import Data.Quantity
( Quantity (..) )
import Data.Text
( Text )
import GHC.IO.Encoding
( mkTextEncoding, setLocaleEncoding )
import Network.HTTP.Client
( defaultManagerSettings
, managerResponseTimeout
Expand Down Expand Up @@ -100,8 +100,7 @@ instance KnownCommand Jormungandr where
commandName = "cardano-wallet-jormungandr"

main :: forall t. (t ~ Jormungandr) => IO ()
main = withLogging Nothing Info $ \logging -> do
setUtf8LenientCodecs
main = withUtf8Encoding $ withLogging Nothing Info $ \logging ->
hspec $ do
describe "No backend required" $ do
describe "Cardano.Wallet.NetworkSpec" $ parallel NetworkLayer.spec
Expand Down Expand Up @@ -163,11 +162,6 @@ specWithServer logCfg = aroundAll withContext . after tearDown
serveWallet @'Testnet logCfg (SyncTolerance 10) Nothing "127.0.0.1"
ListenOnRandomPort (Launch jmCfg) setup

-- | Set a utf8 text encoding that doesn't crash when non-utf8 bytes are
-- encountered.
setUtf8LenientCodecs :: IO ()
setUtf8LenientCodecs = mkTextEncoding "UTF-8//IGNORE" >>= setLocaleEncoding

sockAddrPort :: SockAddr -> Port a
sockAddrPort addr = Port . fromIntegral $ case addr of
SockAddrInet p _ -> p
Expand Down

0 comments on commit 1bf3526

Please sign in to comment.