Skip to content

Commit

Permalink
Merge #3182
Browse files Browse the repository at this point in the history
3182: Fix BlockfrostSpec on Windows r=Anviking a=Unisay

- [x] I have used relative path to socket counting on it being correct path on all OSs.

Co-authored-by: Yuriy Lazaryev <yuriy.lazaryev@iohk.io>
  • Loading branch information
iohk-bors[bot] and Unisay authored Mar 18, 2022
2 parents a250581 + f1654eb commit f6d4db7
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ import Options.Applicative
, info
)
import Test.Hspec
( Spec
, describe
, expectationFailure
, it
, pendingWith
, shouldBe
, shouldReturn
)
( Spec, describe, expectationFailure, it, shouldBe, shouldReturn )
import Test.Utils.Platform
( isWindows )
import UnliftIO
( withSystemTempFile )
import UnliftIO.IO
Expand All @@ -38,10 +33,8 @@ import UnliftIO.IO
spec :: Spec
spec = describe "Blockfrost CLI options" $ do
it "modeOption --node-socket" $ do
-- Named pipes are used on windows
pendingWith "Fails on windows: https://github.com/input-output-hk/cardano-wallet/pull/3160#issuecomment-1071163285"
let parserInfo = info modeOption fullDesc
args = ["--node-socket", "/tmp/file"]
args = ["--node-socket", mockSocketOrPipe]
case execParserPure defaultPrefs parserInfo args of
Failure pf -> expectationFailure $ show pf
CompletionInvoked cr -> expectationFailure $ show cr
Expand All @@ -63,14 +56,18 @@ spec = describe "Blockfrost CLI options" $ do
Blockfrost.Project Testnet (T.pack projectId)

it "modeOption requires --light flag" $ do
-- Named pipes are used on windows
pendingWith "Fails on windows: https://github.com/input-output-hk/cardano-wallet/pull/3160#issuecomment-1071163285"
let parserInfo = info modeOption fullDesc
args = ["--blockfrost-token-file", "/tmp/file"]
args = ["--blockfrost-token-file", mockSocketOrPipe]
case execParserPure defaultPrefs parserInfo args of
Failure pf | (help, _code, _int) <- execFailure pf "" ->
show help `shouldBe`
"Missing: --light\n\n\
\Usage: (--node-socket FILE | \
\Usage: (--node-socket " <> nodeSocketMetavar <> " | \
\--light --blockfrost-token-file FILE)"
result -> expectationFailure $ show result

nodeSocketMetavar :: String
nodeSocketMetavar = if isWindows then "PIPENAME" else "FILE"

mockSocketOrPipe :: String
mockSocketOrPipe = if isWindows then "\\\\.\\pipe\\test" else "/tmp/pipe"

0 comments on commit f6d4db7

Please sign in to comment.