mirror of
https://github.com/ilyakooo0/docker-hs.git
synced 2024-09-11 10:35:29 +03:00
Merge pull request #49 from DaQuirm/fix/envvar-json-encoding
Fix EnvVar JSON encoding
This commit is contained in:
commit
ea7f6b0d5b
@ -1348,7 +1348,7 @@ instance FromJSON EnvVar where
|
||||
parseJSON _ = fail "EnvVar is not a string"
|
||||
|
||||
instance ToJSON EnvVar where
|
||||
toJSON (EnvVar n v) = object [n .= v]
|
||||
toJSON (EnvVar n v) = JSON.String $ n <> T.pack "=" <> v
|
||||
|
||||
-- | ExposedPort represents a port (and it's type)
|
||||
-- that a container should expose to other containers or the host system.
|
||||
|
@ -163,6 +163,15 @@ testEntrypointJson = testGroup "Testing ContainerConfig JSON" [testSample1, test
|
||||
Just (Entrypoint sampleEntrypointArr)
|
||||
sampleEntrypointArr = ["cmd", "--some-flag", "--some-flag2"]
|
||||
|
||||
testEnvVarJson :: TestTree
|
||||
testEnvVarJson = testGroup "Testing EnvVar JSON" [testSampleEncode, testSampleDecode]
|
||||
where
|
||||
testSampleEncode =
|
||||
testCase "Test toJSON" $ assert $ JSON.toJSON (EnvVar "cellar" "door") == JSON.String "cellar=door"
|
||||
testSampleDecode =
|
||||
testCase "Test fromJSON" $ assert $ (JSON.decode "\"cellar=door\"" :: Maybe EnvVar) ==
|
||||
Just (EnvVar "cellar" "door")
|
||||
|
||||
integrationTests :: TestTree
|
||||
integrationTests =
|
||||
testGroup
|
||||
@ -183,6 +192,7 @@ jsonTests =
|
||||
, testLabelsJson
|
||||
, testLogDriverOptionsJson
|
||||
, testEntrypointJson
|
||||
, testEnvVarJson
|
||||
]
|
||||
|
||||
setup :: IO ()
|
||||
|
Loading…
Reference in New Issue
Block a user