Skip to content

Commit db62111

Browse files
committed
Disable mock test for MacOS and Windows
1 parent 9ba65cd commit db62111

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

cardano-api/cardano-api.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ test-suite cardano-api-test
348348
ouroboros-network-api,
349349
plutus-ledger-api,
350350
tasty,
351+
tasty-expected-failure,
351352
tasty-hedgehog,
352353
tasty-quickcheck,
353354
text,

cardano-api/test/cardano-api-test/Test/Cardano/Api/IPC.hs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,29 @@ import Control.Concurrent (MVar, killThread, newEmptyMVar, putMVar, readMVar)
1919
import Control.Concurrent.Lifted (forkFinally)
2020
import Control.Exception.Lifted (bracket)
2121
import Control.Monad.Trans.Control (MonadBaseControl)
22+
import Data.Bool (bool)
2223
import Data.ByteString (ByteString)
2324
import Data.Map qualified as Map
2425
import Data.Monoid (Any)
2526
import Data.Set qualified as Set
27+
import Data.String (fromString)
2628
import Lens.Micro ((&))
2729
import Network.Socket
2830
import Network.Socket.ByteString (sendAll)
2931
import System.Directory (removeFile)
32+
import System.Info qualified as SYS
3033

3134
import Test.Cardano.Ledger.Common (HasCallStack, when)
3235

3336
import Hedgehog (MonadTest, Property, success)
3437
import Hedgehog qualified as H
3538
import Hedgehog.Extras qualified as H
39+
import Hedgehog.Extras.Stock.OS (isWin32)
3640
import Test.Tasty (TestTree, testGroup)
37-
import Test.Tasty.Hedgehog
41+
import Test.Tasty.ExpectedFailure (wrapTest)
42+
import Test.Tasty.Hedgehog qualified as H
43+
import Test.Tasty.Providers (testPassed)
44+
import Test.Tasty.Runners (Result (resultShortDescription))
3845

3946
prop_mockInteractionWithNode :: Property
4047
prop_mockInteractionWithNode =
@@ -188,9 +195,28 @@ tests :: TestTree
188195
tests =
189196
testGroup
190197
"Test.Cardano.Api.IPC"
191-
[ testProperty "Test mock interation with node" prop_mockInteractionWithNode
198+
[ ignoreOnMacAndWindows "Test mock interation with node" prop_mockInteractionWithNode
192199
]
193200

201+
type Os = String
202+
203+
isMacOS :: Bool
204+
isMacOS = SYS.os == "darwin"
205+
206+
ignoreOnMacAndWindows :: String -> Property -> TestTree
207+
ignoreOnMacAndWindows pName prop =
208+
bool id (ignoreOn "MacOS and Windows") (isMacOS || isWin32) $
209+
H.testPropertyNamed pName (fromString pName) prop
210+
211+
ignoreOn :: Os -> TestTree -> TestTree
212+
ignoreOn os =
213+
wrapTest $
214+
const $
215+
return $
216+
(testPassed ("IGNORED on " <> os))
217+
{ resultShortDescription = "IGNORED on " <> os
218+
}
219+
194220
-- | Creates a mock node socket that replays the binary data from the given file.
195221
-- To capture the raw data you could run @socat@ like this:
196222
--

0 commit comments

Comments
 (0)