Skip to content

Commit fb97b0f

Browse files
committed
Ported distributed-process-supervisor
1 parent 6ced13c commit fb97b0f

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ test-suite SupervisorTests
7878
network-transport-tcp >= 0.4 && < 0.9,
7979
binary >= 0.8 && < 0.9,
8080
deepseq,
81-
HUnit >= 1.2 && < 2,
8281
stm,
83-
test-framework >= 0.6 && < 0.9,
84-
test-framework-hunit,
82+
tasty >= 1.5 && <1.6,
83+
tasty-hunit >=0.10 && <0.11,
8584
exceptions >= 0.10 && < 0.11
8685
hs-source-dirs: tests
8786
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-name-shadowing -fno-warn-unused-do-bind
@@ -106,10 +105,9 @@ test-suite NonThreadedSupervisorTests
106105
network-transport-tcp >= 0.4 && < 0.9,
107106
binary >= 0.8 && < 0.9,
108107
deepseq,
109-
HUnit >= 1.2 && < 2,
110108
stm,
111-
test-framework >= 0.6 && < 0.9,
112-
test-framework-hunit,
109+
tasty >= 1.5 && <1.6,
110+
tasty-hunit >=0.10 && <0.11,
113111
exceptions >= 0.10 && < 0.11
114112
hs-source-dirs: tests
115113
ghc-options: -rtsopts -fno-warn-unused-do-bind -fno-warn-name-shadowing

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

+5-14
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ import Control.Monad.Catch (finally)
5151
import Data.ByteString.Lazy (empty)
5252
import Data.Maybe (catMaybes, isNothing, isJust)
5353

54-
import Test.HUnit (Assertion, assertFailure, assertEqual, assertBool)
55-
import Test.Framework (Test, testGroup)
56-
import Test.Framework.Providers.HUnit (testCase)
54+
import Test.Tasty (TestTree, testGroup)
55+
import Test.Tasty.HUnit (Assertion, assertFailure, assertEqual, assertBool, testCase)
5756
import TestUtils hiding (waitForExit)
5857
import qualified Network.Transport as NT
5958

@@ -1198,7 +1197,7 @@ withClosure' fn clj ctx = do
11981197
cs <- toChildStart clj
11991198
fn cs ctx
12001199

1201-
tests :: NT.Transport -> IO [Test]
1200+
tests :: NT.Transport -> IO TestTree
12021201
tests transport = do
12031202
putStrLn $ concat [ "NOTICE: Branch Tests (Relying on Non-Guaranteed Message Order) "
12041203
, "Can Fail Intermittently" ]
@@ -1215,8 +1214,8 @@ tests transport = do
12151214
let withSup' sm = runInTestContext' localNode sm
12161215
let withSupervisor = runInTestContext localNode singleTestLock ParallelShutdown
12171216
let withSupervisor' = runInTestContext' localNode ParallelShutdown
1218-
return
1219-
[ testGroup "Supervisor Processes"
1217+
return $
1218+
testGroup "Supervisor Processes"
12201219
[
12211220
testGroup "Starting And Adding Children"
12221221
[
@@ -1449,14 +1448,6 @@ tests transport = do
14491448
(delayedRestartAfterThreeAttempts withSupervisor')
14501449
]
14511450
]
1452-
{- , testGroup "CI"
1453-
[ testCase "Flush [NonTest]"
1454-
(withSupervisor'
1455-
(RestartRight defaultLimits (RestartInOrder LeftToRight)) []
1456-
(\_ -> sleep $ seconds 20))
1457-
]
1458-
-}
1459-
]
14601451

14611452
main :: IO ()
14621453
main = testMain $ tests

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ import qualified Control.Exception as Exception
6060
import Control.Monad (forever)
6161
import Control.Monad.Catch (catch)
6262
import Control.Monad.STM (atomically)
63-
import Test.HUnit (Assertion, assertEqual)
64-
import Test.HUnit.Base (assertBool)
65-
import Test.Framework (Test, defaultMain)
63+
import Test.Tasty (TestTree, defaultMain)
64+
import Test.Tasty.HUnit (Assertion, assertEqual, assertBool)
6665
import Control.DeepSeq
6766

6867
import Network.Transport.TCP
@@ -137,7 +136,7 @@ stopLogger :: Logger -> IO ()
137136
stopLogger = (flip Exception.throwTo) Exception.ThreadKilled . _tid
138137

139138
-- | Given a @builder@ function, make and run a test suite on a single transport
140-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
139+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
141140
testMain builder = do
142141
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters
143142
testData <- builder transport

0 commit comments

Comments
 (0)