on master help sign in
Fixes failing tests
fe96d40Deni Bertovic
src/Docker/Client/Types.hs+4−3
@@ -208,7 +208,7 @@ data ContainerDetails = ContainerDetails {
208 , containerDetailsId :: ContainerID
208 , containerDetailsId :: ContainerID
209 , containerDetailsImage :: ImageID
209 , containerDetailsImage :: ImageID
210 , mountLabel :: Text
210 , mountLabel :: Text
211− , names :: [Text]
211+ , name :: Text
212 , networkSettings :: NetworkSettings
212 , networkSettings :: NetworkSettings
213 , path :: FilePath
213 , path :: FilePath
214 , processLabel :: Text
214 , processLabel :: Text
@@ -335,7 +335,7 @@ instance FromJSON ContainerDetails where
335 id <- parseJSON v
335 id <- parseJSON v
336 image <- o .: "Image"
336 image <- o .: "Image"
337 mountLabel <- o .: "MountLabel"
337 mountLabel <- o .: "MountLabel"
338− names <- o .: "Names"
338+ name <- o .: "Name"
339 networkSettings <- o .: "NetworkSettings"
339 networkSettings <- o .: "NetworkSettings"
340 path <- o .: "Path"
340 path <- o .: "Path"
341 processLabel <- o .: "ProcessLabel"
341 processLabel <- o .: "ProcessLabel"
@@ -343,7 +343,7 @@ instance FromJSON ContainerDetails where
343 restartCount <- o .: "RestartCount"
343 restartCount <- o .: "RestartCount"
344 state <- o .: "State"
344 state <- o .: "State"
345 mounts <- o .: "Mounts"
345 mounts <- o .: "Mounts"
346− return $ ContainerDetails appArmor args config created driver hostConfig hostnamePath hostsPath logPath id image mountLabel names networkSettings path processLabel resolveConfPath restartCount state mounts
346+ return $ ContainerDetails appArmor args config created driver hostConfig hostnamePath hostsPath logPath id image mountLabel name networkSettings path processLabel resolveConfPath restartCount state mounts
347 parseJSON _ = fail "ContainerDetails is not an object"
347 parseJSON _ = fail "ContainerDetails is not an object"
348
348
349instance ToJSON ContainerID where
349instance ToJSON ContainerID where
@@ -752,6 +752,7 @@ instance ToJSON [Volume] where
752
752
753instance FromJSON [Volume] where
753instance FromJSON [Volume] where
754 parseJSON (JSON.Object o) = return $ map (Volume . T.unpack) $ HM.keys o
754 parseJSON (JSON.Object o) = return $ map (Volume . T.unpack) $ HM.keys o
755+ parseJSON (JSON.Null) = return []
755 parseJSON _ = fail "Volume is not an object"
756 parseJSON _ = fail "Volume is not an object"
756
757
757
758
tests/tests.hs+2−2
@@ -57,7 +57,7 @@ testFindImage = runDocker $ do
57
57
58testRunAndReadLog :: IO ()
58testRunAndReadLog :: IO ()
59testRunAndReadLog = runDocker $ do
59testRunAndReadLog = runDocker $ do
60− containerId <- createContainer (defaultCreateOpts (testImageName <> ":latest"))
60+ containerId <- createContainer (defaultCreateOpts (testImageName <> ":latest")) Nothing
61 c <- fromRight containerId
61 c <- fromRight containerId
62 status1 <- startContainer defaultStartOpts c
62 status1 <- startContainer defaultStartOpts c
63 _ <- inspectContainer c >>= fromRight
63 _ <- inspectContainer c >>= fromRight
@@ -83,7 +83,7 @@ testVolumesJson = testGroup "Testing Volumes JSON" [ testSample1, testSample2 ]
83 where
83 where
84 testSample1 = testCase "Test exposing volume: /tmp" $ assert $ JSON.toJSON sampleVolumes ^. key "/tmp" . _Object == HM.empty
84 testSample1 = testCase "Test exposing volume: /tmp" $ assert $ JSON.toJSON sampleVolumes ^. key "/tmp" . _Object == HM.empty
85 testSample2 = testCase "Test exposing volume: /opt" $ assert $ JSON.toJSON sampleVolumes ^. key "/opt" . _Object == HM.empty
85 testSample2 = testCase "Test exposing volume: /opt" $ assert $ JSON.toJSON sampleVolumes ^. key "/opt" . _Object == HM.empty
86− sampleVolumes = Volumes ["/tmp", "/opt"]
86+ sampleVolumes = [Volume "/tmp", Volume "/opt"]
87
87
88integrationTests :: TestTree
88integrationTests :: TestTree
89integrationTests = testGroup "Integration Tests" [
89integrationTests = testGroup "Integration Tests" [