distributed-process-tests 0.4.12 → 0.4.13
raw patch · 7 files changed
+75/−97 lines, 7 filesdep −ghc-primdep −rematchdep ~basedep ~binarydep ~bytestringsetup-changednew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: ghc-prim, rematch
Dependency ranges changed: base, binary, bytestring, exceptions, network
API changes (from Hackage documentation)
- Control.Distributed.Process.Tests.Internal.Utils: expectThat :: a -> Matcher a -> Process ()
- Control.Distributed.Process.Tests.Internal.Utils: shouldBe :: a -> Matcher a -> Process ()
- Control.Distributed.Process.Tests.Internal.Utils: shouldMatch :: a -> Matcher a -> Process ()
Files
- Setup.hs +0/−2
- distributed-process-tests.cabal +52/−32
- src/Control/Distributed/Process/Tests/CH.hs +9/−20
- src/Control/Distributed/Process/Tests/Internal/Utils.hs +2/−20
- src/Control/Distributed/Process/Tests/Mx.hs +12/−15
- src/Control/Distributed/Process/Tests/Stats.hs +0/−4
- src/Control/Distributed/Process/Tests/Tracing.hs +0/−4
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
distributed-process-tests.cabal view
@@ -1,22 +1,38 @@+cabal-version: 3.0 name: distributed-process-tests-version: 0.4.12+version: 0.4.13 synopsis: Tests and test support tools for distributed-process. homepage: http://github.com/haskell-distributed/distributed-process/tree/master/distributed-process-tests-description: Tests and test suite for Cloud Haskell libraries.-license: BSD3+description: Tests and test suite for Cloud Haskell libraries, specifically the core distributed-process library.+license: BSD-3-Clause license-file: LICENSE Author: Duncan Coutts, Nicolas Wu, Edsko de Vries-Maintainer: Tim Watson <watson.timothy@gmail.com>+maintainer: The Distributed Haskell team copyright: Well-Typed LLP category: Control, Cloud Haskell build-type: Simple-cabal-version: >=1.10 +source-repository head+ Type: git+ Location: https://github.com/haskell-distributed/distributed-process+ SubDir: packages/distributed-process-tests+ flag tcp Description: build and run TCP tests Default: False +common warnings+ ghc-options: -Wall+ -Wcompat+ -Widentities+ -Wincomplete-uni-patterns+ -Wincomplete-record-updates+ -Wredundant-constraints+ -fhide-source-paths+ -Wpartial-fields+ library+ import: warnings exposed-modules: Network.Transport.Test Control.Distributed.Process.Tests.CH Control.Distributed.Process.Tests.Closure@@ -25,25 +41,24 @@ Control.Distributed.Process.Tests.Stats Control.Distributed.Process.Tests.Tracing Control.Distributed.Process.Tests.Internal.Utils- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, ansi-terminal >= 0.5,- binary >= 0.5 && < 0.9,- bytestring >= 0.9 && < 0.13,+ binary >= 0.8 && < 0.9,+ bytestring >= 0.10 && < 0.13, distributed-process >= 0.6.0 && < 0.8, distributed-static,- exceptions >= 0.5,+ exceptions >= 0.10, HUnit >= 1.2 && < 1.7, network-transport >= 0.4.1.0 && < 0.6,- network >= 2.5 && < 3.2,+ network >= 2.5 && < 3.3, random >= 1.0 && < 1.3,- rematch >= 0.1.2.1, setenv >= 0.1.1.3, test-framework >= 0.6 && < 0.9, test-framework-hunit >= 0.2.0 && < 0.4, stm hs-source-dirs: src default-language: Haskell98- ghc-options: -Wall -fno-warn-unused-do-bind+ ghc-options: -fno-warn-unused-do-bind default-extensions: CPP, ExistentialQuantification, FlexibleInstances,@@ -53,30 +68,30 @@ RankNTypes, RecordWildCards, ScopedTypeVariables- if impl(ghc <= 7.4.2)- Build-Depends: ghc-prim == 0.2.0.0 Test-Suite TestCHInMemory+ import: warnings Type: exitcode-stdio-1.0 Main-Is: runInMemory.hs CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.CH- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, distributed-process-tests,- network >= 2.3 && < 3.2,+ network >= 2.3 && < 3.3, network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, test-framework >= 0.6 && < 0.9 default-extensions: CPP default-language: Haskell98- ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind HS-Source-Dirs: tests Test-Suite TestCHInTCP+ import: warnings Type: exitcode-stdio-1.0 Main-Is: runTCP.hs CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.CH if flag(tcp)- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, distributed-process-tests, network >= 2.5 && < 3.2, network-transport >= 0.4.1.0 && < 0.6,@@ -86,47 +101,50 @@ Buildable: False default-extensions: CPP default-language: Haskell98- ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind HS-Source-Dirs: tests Test-Suite TestClosure+ import: warnings Type: exitcode-stdio-1.0 Main-Is: runInMemory.hs CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Closure- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, distributed-process-tests,- network >= 2.3 && < 3.2,+ network >= 2.3 && < 3.3, network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, test-framework >= 0.6 && < 0.9 default-extensions: CPP default-language: Haskell98- ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind HS-Source-Dirs: tests Test-Suite TestStats+ import: warnings Type: exitcode-stdio-1.0 Main-Is: runInMemory.hs CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Stats- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, distributed-process-tests,- network >= 2.3 && < 3.2,+ network >= 2.3 && < 3.3, network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, test-framework >= 0.6 && < 0.9 default-extensions: CPP default-language: Haskell98- ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind HS-Source-Dirs: tests Test-Suite TestMxInMemory+ import: warnings Type: exitcode-stdio-1.0 Main-Is: runInMemory.hs CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Mx- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, distributed-process-tests,- network >= 2.3 && < 3.2,+ network >= 2.3 && < 3.3, network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, test-framework >= 0.6 && < 0.9@@ -136,12 +154,13 @@ HS-Source-Dirs: tests Test-Suite TestTracingInMemory+ import: warnings Type: exitcode-stdio-1.0 Main-Is: runInMemory.hs CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Tracing- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, distributed-process-tests,- network >= 2.3 && < 3.2,+ network >= 2.3 && < 3.3, network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, test-framework >= 0.6 && < 0.9@@ -151,16 +170,17 @@ HS-Source-Dirs: tests Test-Suite TestMxInTCP+ import: warnings Type: exitcode-stdio-1.0 Main-Is: runInMemory.hs CPP-Options: -DTEST_SUITE_MODULE=Control.Distributed.Process.Tests.Mx- Build-Depends: base >= 4.9 && < 5,+ Build-Depends: base >= 4.14 && < 5, distributed-process-tests,- network >= 2.3 && < 3.2,+ network >= 2.3 && < 3.3, network-transport >= 0.4.1.0 && < 0.6, network-transport-inmemory >= 0.5, test-framework >= 0.6 && < 0.9 default-extensions: CPP default-language: Haskell98- ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind HS-Source-Dirs: tests
src/Control/Distributed/Process/Tests/CH.hs view
@@ -1,8 +1,5 @@ module Control.Distributed.Process.Tests.CH (tests) where -#if ! MIN_VERSION_base(4,6,0)-import Prelude hiding (catch)-#endif import Network.Transport.Test (TestTransport(..)) @@ -45,11 +42,9 @@ import Control.Distributed.Process.Tests.Internal.Utils (pause) import Control.Distributed.Process.Serializable (Serializable) import Data.Maybe (isNothing, isJust)-import Test.HUnit (Assertion, assertBool, assertFailure)+import Test.HUnit (Assertion, assertBool, assertEqual, assertFailure) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase)-import Control.Rematch hiding (match, isNothing, isJust)-import Control.Rematch.Run (Match(..)) newtype Ping = Ping ProcessId deriving (Typeable, Binary, Show)@@ -61,12 +56,6 @@ -- Supporting definitions -- -------------------------------------------------------------------------------- -expectThat :: a -> Matcher a -> Assertion-expectThat a matcher = case res of- MatchSuccess -> return ()- (MatchFailure msg) -> assertFailure msg- where res = runMatch matcher a- -- | Like fork, but throw exceptions in the child thread to the parent forkTry :: IO () -> IO ThreadId forkTry p = do@@ -1408,7 +1397,7 @@ return () result <- takeMVar done- expectThat result $ equalTo (5, 10)+ assertEqual mempty (5, 10) result testCatches :: TestTransport -> Assertion testCatches TestTransport{..} = do@@ -1436,7 +1425,7 @@ parent <- liftIO $ takeMVar parentPid child <- liftIO $ takeMVar spawnedPid- expectThat parent $ isNot $ equalTo child+ assertBool mempty (not $ parent == child) testDie :: TestTransport -> Assertion testDie TestTransport{..} = do@@ -1860,10 +1849,10 @@ ] -- Tests that fail occasionally and should be revised- , testGroup "Flaky" [- testCase "Reconnect" (testReconnect testtrans)- , testCase "Registry" (testRegistry testtrans)- , testCase "MergeChannels" (testMergeChannels testtrans)- , testCase "MonitorUnreachable" (testMonitorUnreachable testtrans True False)- ]+ -- , testGroup "Flaky" [+ -- testCase "Reconnect" (testReconnect testtrans)+ -- , testCase "Registry" (testRegistry testtrans)+ -- , testCase "MergeChannels" (testMergeChannels testtrans)+ -- , testCase "MonitorUnreachable" (testMonitorUnreachable testtrans True False)+ -- ] ]
src/Control/Distributed/Process/Tests/Internal/Utils.hs view
@@ -21,11 +21,8 @@ , Ping(Ping) , ping , pause- , shouldBe- , shouldMatch , shouldContain , shouldNotContain- , expectThat , synchronisedAssertion -- test process utilities , TestProcessControl@@ -48,9 +45,6 @@ , stash ) where -#if ! MIN_VERSION_base(4,6,0)-import Prelude hiding (catch)-#endif import Control.Concurrent ( ThreadId , myThreadId@@ -82,8 +76,6 @@ import Control.Monad (forever, void) import Control.Monad.Catch (finally, catch) import Control.Monad.STM (atomically)-import Control.Rematch hiding (match)-import Control.Rematch.Run import Data.Binary import Data.Typeable (Typeable) @@ -142,23 +134,13 @@ stash :: TestResult a -> a -> Process () stash mvar x = liftIO $ putMVar mvar x -expectThat :: a -> Matcher a -> Process ()-expectThat a matcher = case res of- MatchSuccess -> return ()- (MatchFailure msg) -> liftIO $ assertFailure msg- where res = runMatch matcher a -shouldBe :: a -> Matcher a -> Process ()-shouldBe = expectThat- shouldContain :: (Show a, Eq a) => [a] -> a -> Process ()-shouldContain xs x = expectThat xs $ hasItem (equalTo x)+shouldContain xs x = liftIO $ assertBool mempty (x `elem` xs) shouldNotContain :: (Show a, Eq a) => [a] -> a -> Process ()-shouldNotContain xs x = expectThat xs $ isNot (hasItem (equalTo x))+shouldNotContain xs x = liftIO $ assertBool mempty (not $ x `elem` xs) -shouldMatch :: a -> Matcher a -> Process ()-shouldMatch = expectThat -- | Run the supplied @testProc@ using an @MVar@ to collect and assert -- against its result. Uses the supplied @note@ if the assertion fails.
src/Control/Distributed/Process/Tests/Mx.hs view
@@ -35,21 +35,18 @@ ) import Control.Monad (void, unless) import Control.Monad.Catch(finally, bracket, try)-import Control.Rematch (equalTo) import Data.Binary import Data.List (find, sort, intercalate) import Data.Maybe (isJust, fromJust, isNothing, fromMaybe, catMaybes) import Data.Typeable import GHC.Generics hiding (from)-#if ! MIN_VERSION_base(4,6,0)-import Prelude hiding (catch, log)-#endif import Test.Framework ( Test , testGroup ) import Test.Framework.Providers.HUnit (testCase)+import Test.HUnit (assertBool, assertEqual) data Publish = Publish deriving (Typeable, Generic, Eq)@@ -111,7 +108,7 @@ died <- receiveTimeout 10000000 [ matchIf (\(ProcessMonitorNotification r _ _) -> r == mRef) (const $ return True) ]- died `shouldBe` equalTo (Just True)+ liftIO $ assertEqual mempty (Just True) died testAgentPrioritisation :: TestResult [String] -> Process () testAgentPrioritisation result = do@@ -257,22 +254,22 @@ register label p1 reg1 <- receiveChanTimeout delay regSink- reg1 `shouldBe` equalTo (Just (label, p1))+ liftIO $ assertEqual mempty (Just (label, p1)) reg1 unregister label unreg1 <- receiveChanTimeout delay unRegSink- unreg1 `shouldBe` equalTo (Just (label, p1))+ liftIO $ assertEqual mempty (Just (label, p1)) unreg1 register label p2 reg2 <- receiveChanTimeout delay regSink- reg2 `shouldBe` equalTo (Just (label, p2))+ liftIO $ assertEqual mempty (Just (label, p2)) reg2 reregister label p1 unreg2 <- receiveChanTimeout delay unRegSink- unreg2 `shouldBe` equalTo (Just (label, p2))+ liftIO $ assertEqual mempty (Just (label, p2)) unreg2 reg3 <- receiveChanTimeout delay regSink- reg3 `shouldBe` equalTo (Just (label, p1))+ liftIO $ assertEqual mempty (Just (label, p1)) reg3 mapM_ (flip kill $ "test-complete") [agent, p1, p2] @@ -308,17 +305,17 @@ register label1 p1 reg1 <- receiveChanTimeout delay regSink- reg1 `shouldBe` equalTo (Just (label1, p1))+ liftIO $ assertEqual mempty (Just (label1, p1)) reg1 register label2 p1 reg2 <- receiveChanTimeout delay regSink- reg2 `shouldBe` equalTo (Just (label2, p1))+ liftIO $ assertEqual mempty (Just (label2, p1)) reg2 n1 <- whereis label1- n1 `shouldBe` equalTo (Just p1)+ liftIO $ assertEqual mempty (Just p1) n1 n2 <- whereis label2- n2 `shouldBe` equalTo (Just p1)+ liftIO $ assertEqual mempty (Just p1) n2 kill p1 "goodbye" @@ -448,7 +445,7 @@ case res of Left (ProcessExitException _ m) -> (liftIO $ putStrLn $ "SomeException-" ++ show m) >> die m- Right tr -> tr `shouldBe` equalTo True+ Right tr -> liftIO $ assertBool mempty tr where
src/Control/Distributed/Process/Tests/Stats.hs view
@@ -16,10 +16,6 @@ import Data.Binary () import Data.Typeable () -#if ! MIN_VERSION_base(4,6,0)-import Prelude hiding (catch)-#endif- import Test.Framework ( Test , testGroup
src/Control/Distributed/Process/Tests/Tracing.hs view
@@ -23,11 +23,7 @@ import qualified Control.Exception as IO (bracket) import Data.List (isPrefixOf, isSuffixOf) -#if ! MIN_VERSION_base(4,6,0)-import Prelude hiding (catch, log)-#else import Prelude hiding ((<*))-#endif import Test.Framework ( Test