graceful 0.1.1.3 → 0.1.1.4
raw patch · 2 files changed
+13/−5 lines, 2 filesdep ~basedep ~networkdep ~unix
Dependency ranges changed: base, network, unix
Files
- graceful.cabal +5/−5
- test/System/Posix/GracefulSpec.hs +8/−0
graceful.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: graceful-version: 0.1.1.3+version: 0.1.1.4 synopsis: Library to write graceful shutdown / upgrade service. description: Library to write graceful shutdown / upgrade service. license: BSD3@@ -13,7 +13,7 @@ category: System build-type: Simple cabal-version: >=1.8-tested-with: GHC ==7.4.1, GHC ==7.6.3+tested-with: GHC ==7.4.1, GHC ==7.6.3, GHC ==7.8.3 extra-source-files: sample/sample.hs -- test target servers@@ -31,9 +31,9 @@ other-modules: System.Posix.Graceful.Handler System.Posix.Graceful.Worker Network.Socket.Wrapper- build-depends: base >=4.5 && <4.7- , network >=2.3 && <2.5- , unix >=2.5 && <2.7+ build-depends: base >=4.5 && <4.8+ , network >=2.3 && <2.6+ , unix >=2.5 && <2.8 , stm >=2.3 && <2.5 , directory >=1.1 && <1.3
test/System/Posix/GracefulSpec.hs view
@@ -7,7 +7,10 @@ import Data.List import Network import Network.Socket+#if MIN_VERSION_process(1,0,1)+#else import System.Cmd+#endif import System.Directory import System.Exit import System.FilePath@@ -47,6 +50,7 @@ waitProcessIncreaseTo :: Int -> IO () waitProcessIncreaseTo n = do+ threadDelay 1000000 procs <- fmap length ps procs `shouldSatisfy` (<= n) if procs < n@@ -55,6 +59,7 @@ waitProcessDecreaseTo :: Int -> IO () waitProcessDecreaseTo n = do+ threadDelay 1000000 procs <- fmap length ps procs `shouldSatisfy` (>= n) if procs > n@@ -63,11 +68,14 @@ run :: IO () -> IO () run action = do+ procs <- fmap length ps+ procs `shouldBe` 0 buildAsEchoServer "test/echo.hs" let file = "/tmp/echo-server" mapM_ (removeFileIfExist . (file ++)) [ ".sock", ".pid" ] rawSystem file [] `shouldReturn` ExitSuccess waitStandby $ file ++ ".pid"+ waitProcessIncreaseTo 5 action waitProcessDecreaseTo 0