@@ -54,6 +54,11 @@ testDockerVersion =
5454 do v <- getDockerVersion
5555 lift $ assert $ isRight v
5656
57+testStopNonexisting :: IO ()
58+testStopNonexisting = runDocker $ do
59+ res <- stopContainer DefaultTimeout $ fromJust $ toContainerID "thisshouldnotexist"
60+ lift $ assert $ isLeft res
61+
5762testFindImage :: IO ()
5863testFindImage =
5964 runDocker $
@@ -158,6 +163,7 @@ integrationTests =
158163 [ testCase "Get docker version" testDockerVersion
159164 , testCase "Find image by name" testFindImage
160165 , testCase "Run a dummy container and read its log" testRunAndReadLog
166+ , testCase "Try to stop a container that doesn't exist" testStopNonexisting
161167 ]
162168
163169jsonTests :: TestTree
@@ -174,6 +180,8 @@ jsonTests =
174180setup :: IO ()
175181setup = system ("docker build -t " ++ unpack testImageName ++ " tests") >> return ()
176182
183+isLeft = not . isRight
184+
177185isRight (Left _) = False
178186isRight (Right _) = True
179187