-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrivileged.purs
More file actions
28 lines (23 loc) · 1012 Bytes
/
Privileged.purs
File metadata and controls
28 lines (23 loc) · 1012 Bytes
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
module Test.Privileged where
import Prelude
import Control.Monad.Error.Class (throwError)
import Data.Either (Either(..))
import Effect.Aff (error)
import Test.Assertions (shouldInclude)
import Test.Spec (Spec, describe, it)
import Test.Spec.Assertions (shouldEqual)
import Test.Testcontainers (setPrivilegedMode, setWaitStrategy, withContainer)
import Test.Testcontainers.Types (WaitStrategy(..))
import Test.Utils (launchCommand, mkAffContainer)
privilegedTest :: Spec Unit
privilegedTest = describe "Privileged Mode" $ do
it "should set privileged mode correctly" $ do
dockerDind <- mkAffContainer "docker:dind" $ setPrivilegedMode <<< setWaitStrategy [ LogOutput "API listen on" 1 ]
res <- withContainer dockerDind $ \c -> do
launchCommand c [ "docker", "ps" ]
(\s -> s `shouldInclude` "STATUS")
(\exitCode -> exitCode `shouldEqual` 0)
-- Check that the withContainer function succeeded
case res of
Left e -> throwError $ error e
Right _ -> pure unit