Skip to content

Commit 1fa4f51

Browse files
committed
CI: make distributed-process-fsm tests as flaky and retry on failure
1 parent 6a3c719 commit 1fa4f51

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/distributed-process-fsm/distributed-process-fsm.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ test-suite FsmTests
5858
distributed-process-fsm,
5959
binary,
6060
tasty >= 1.5 && <1.6,
61+
tasty-flaky >= 0.1.2 && <0.2,
6162
tasty-hunit >=0.10 && <0.11,
6263
hs-source-dirs: tests
6364
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind

packages/distributed-process-fsm/tests/TestFSM.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import Prelude hiding (drop, (*>))
2424

2525

2626
import Test.Tasty(TestTree, testGroup, defaultMain)
27+
import Test.Tasty.Flaky (flakyTest, limitRetries)
2728
import Test.Tasty.HUnit (testCase, assertEqual, assertBool)
2829

2930
import Network.Transport.TCP
@@ -257,6 +258,11 @@ myRemoteTable :: RemoteTable
257258
myRemoteTable =
258259
Control.Distributed.Process.Extras.__remoteTable $ initRemoteTable
259260

261+
-- Some tests are flaky due to the CI environment being noticeable
262+
-- slower (and therefore exposing some race conditions)
263+
flaky :: TestTree -> TestTree
264+
flaky = flakyTest (limitRetries 3)
265+
260266
tests :: NT.Transport -> IO TestTree
261267
tests transport = do
262268
{- verboseCheckWithResult stdArgs -}
@@ -269,8 +275,9 @@ tests transport = do
269275
(runProcess localNode notSoQuirkyDefinitions)
270276
, testCase "Traversing an FSM definition (exit handling)"
271277
(runProcess localNode verifyStopBehaviour)
272-
, testCase "Traversing an FSM definition (mailbox handling)"
273-
(runProcess localNode verifyMailboxHandling)
278+
, flaky
279+
$ testCase "Traversing an FSM definition (mailbox handling)"
280+
(runProcess localNode verifyMailboxHandling)
274281
, testCase "Traversing an FSM definition (nested definitions)"
275282
(runProcess localNode verifyOuterStateHandler)
276283
, testCase "Traversing an FSM definition (event re-publication)"

0 commit comments

Comments
 (0)