-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnvironmentVariables.purs
More file actions
37 lines (30 loc) · 1.09 KB
/
EnvironmentVariables.purs
File metadata and controls
37 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Test.EnvironmentVariables where
import Prelude
import Data.Either (Either(..))
import Effect.Aff (error, throwError)
import Test.Assertions (shouldInclude)
import Test.Spec (Spec, describe, it)
import Test.Spec.Assertions (shouldEqual)
import Test.Testcontainers (setCommand, setEnvironment, withContainer)
import Test.Utils (launchCommand, mkAffContainer)
environmentTest :: Spec Unit
environmentTest = describe "Environment Variables" $ do
it "should set environment variables properly" $ do
sleeperContainer <- mkAffContainer "alpine:latest" $
setEnvironment env
<<< setCommand [ "sleep", "360" ]
res <- withContainer sleeperContainer $ \c -> do
launchCommand c [ "env" ]
( \s -> do
s `shouldInclude` "SOME_VARIABLE=SOME_VALUE"
s `shouldInclude` "OTHER_VARIABLE=OTHER_VALUE"
)
(\exitCode -> exitCode `shouldEqual` 0)
case res of
Left e -> throwError $ error e
Right _ -> pure unit
where
env =
[ { key: "SOME_VARIABLE", value: "SOME_VALUE" }
, { key: "OTHER_VARIABLE", value: "OTHER_VALUE" }
]