Skip to content

Commit 9656c1a

Browse files
committed
Mark distributed-process-supervisor test as flaky and retry on failure
1 parent 1fa4f51 commit 9656c1a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/distributed-process-supervisor/distributed-process-supervisor.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ test-suite SupervisorTests
8181
deepseq,
8282
stm,
8383
tasty >= 1.5 && <1.6,
84+
tasty-flaky >= 0.1.2 && <0.2,
8485
tasty-hunit >=0.10 && <0.11,
8586
exceptions >= 0.10 && < 0.11
8687
hs-source-dirs: tests
@@ -109,6 +110,7 @@ test-suite NonThreadedSupervisorTests
109110
stm,
110111
tasty >= 1.5 && <1.6,
111112
tasty-hunit >=0.10 && <0.11,
113+
tasty-flaky >= 0.1.2 && <0.2,
112114
exceptions >= 0.10 && < 0.11
113115
hs-source-dirs: tests
114116
ghc-options: -rtsopts -fno-warn-unused-do-bind -fno-warn-name-shadowing

packages/distributed-process-supervisor/tests/TestSupervisor.hs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
-- NOTICE: Some of these tests are /unsafe/, and will fail intermittently, since
99
-- they rely on ordering constraints which the Cloud Haskell runtime does not
1010
-- guarantee.
11+
--
12+
-- Such tests can be marked as 'flaky' using 'tasty-flaky', so they get
13+
-- retried on failure.
1114

1215
module Main where
1316

@@ -52,13 +55,17 @@ import Data.ByteString.Lazy (empty)
5255
import Data.Maybe (catMaybes, isNothing, isJust)
5356

5457
import Test.Tasty (TestTree, testGroup)
58+
import Test.Tasty.Flaky (flakyTest, limitRetries)
5559
import Test.Tasty.HUnit (Assertion, assertFailure, assertEqual, assertBool, testCase)
5660
import TestUtils hiding (waitForExit)
5761
import qualified Network.Transport as NT
5862

5963
import System.Random (mkStdGen, randomR)
6064
-- test utilities
6165

66+
flaky :: TestTree -> TestTree
67+
flaky = flakyTest (limitRetries 3)
68+
6269
expectedExitReason :: ProcessId -> String
6370
expectedExitReason sup = "killed-by=" ++ (show sup) ++
6471
",reason=StoppedBySupervisor"
@@ -1304,10 +1311,11 @@ tests transport = do
13041311
(withSupervisor restartOne []
13051312
(withClosure transientChildrenAbnormalExit
13061313
$(mkStaticClosure 'blockIndefinitely)))
1307-
, testCase "ExitShutdown Is Considered Normal"
1308-
(withSupervisor' restartOne []
1309-
(withClosure' transientChildrenExitShutdown
1310-
$(mkStaticClosure 'blockIndefinitely)))
1314+
, flaky $
1315+
testCase "ExitShutdown Is Considered Normal"
1316+
(withSupervisor' restartOne []
1317+
(withClosure' transientChildrenExitShutdown
1318+
$(mkStaticClosure 'blockIndefinitely)))
13111319
, testCase "Intrinsic Children Do Restart When Exiting Abnormally (Closure)"
13121320
(withSupervisor restartOne []
13131321
(withClosure intrinsicChildrenAbnormalExit

0 commit comments

Comments
 (0)