sandwich-contexts-minio
Safe HaskellNone
LanguageHaskell2010

Test.Sandwich.Contexts.MinIO

Description

MinIO is a popular S3-compatible object storage system. This module provides some tools to introduce it, either as a raw binary or via a container system.

The MinIO server will be introduced as a generic TestS3Server. This gives you the ability to easily swap out different S3-compatible stores in your tests.

Synopsis

Introducing MinIO

introduceMinIOViaNix Source #

Arguments

:: forall context (m :: Type -> Type). (HasBaseContext context, HasNixContext context, MonadMask m, MonadUnliftIO m) 
=> MinIOContextOptions

Options

-> SpecFree (LabelValue "testS3Server" TestS3Server :> (LabelValue (AppendSymbol "file-" "minio") (EnvironmentFile "minio") :> context)) m () 
-> SpecFree context m () 

Introduce a MinIO server, deriving the MinIO binary from the Nix context.

introduceMinIOViaBinary Source #

Arguments

:: forall context (m :: Type -> Type). (HasBaseContext context, HasFile context "minio", MonadMask m, MonadUnliftIO m) 
=> MinIOContextOptions

Options

-> SpecFree (LabelValue "testS3Server" TestS3Server :> context) m () 
-> SpecFree context m () 

Introduce a MinIO server, assuming the binary is already available as a HasFile context.

introduceMinIOViaContainer Source #

Arguments

:: forall context (m :: Type -> Type). (HasBaseContext context, MonadMask m, MonadUnliftIO m) 
=> MinIOContextOptions

Options

-> ContainerOptions 
-> SpecFree (LabelValue "testS3Server" TestS3Server :> context) m () 
-> SpecFree context m () 

Introduce a MinIO server by launching a container.

Lower-level versions

withMinIOViaBinary Source #

Arguments

:: (HasBaseContextMonad context m, HasFile context "minio", MonadLoggerIO m, MonadMask m, MonadUnliftIO m) 
=> MinIOContextOptions

Options

-> (TestS3Server -> m [Result]) 
-> m () 

Bracket-style variant of introduceMinIOViaBinary.

withMinIOViaBinary' Source #

Arguments

:: (HasBaseContextMonad context m, MonadLoggerIO m, MonadMask m, MonadUnliftIO m) 
=> FilePath

Path to the minio binary

-> MinIOContextOptions 
-> (TestS3Server -> m [Result]) 
-> m () 

Introduce a MinIO server by manually providing the path to the binary.

Helpers for constructing connections

testS3ServerEndpoint :: TestS3Server -> Text #

Generate an S3 connection string for the given server.

testS3ServerContainerEndpoint :: TestS3Server -> Maybe Text #

Generate an S3 connection string for the given containerized server, for the network address inside the container. Returns Nothing if this server isn't containerized.

testS3ServerConnectInfo :: TestS3Server -> ConnectInfo Source #

Construct a ConnectInfo (from the minio-hs package) for the given TestS3Server.

Re-exports

testS3Server :: Label "testS3Server" TestS3Server #

data TestS3Server #

A generic test S3 server. This can be used by downstream packages like sandwich-contexts-minio.

Constructors

TestS3Server 

Fields

Instances

Instances details
Show TestS3Server # 
Instance details

Defined in Test.Sandwich.Contexts.Types.S3

Eq TestS3Server # 
Instance details

Defined in Test.Sandwich.Contexts.Types.S3

type HasTestS3Server context = HasLabel context "testS3Server" TestS3Server #

data ContainerOptions #

Type to represent generic options for launching containers.

data HttpMode #

Constructors

HttpModeHttp 
HttpModeHttps 
HttpModeHttpsNoValidate

A special mode to allow a server to run in HTTPS mode, but connect to it without HTTPS validation. Useful for tests.

Instances

Instances details
Show HttpMode # 
Instance details

Defined in Test.Sandwich.Contexts.Types.S3

Eq HttpMode # 
Instance details

Defined in Test.Sandwich.Contexts.Types.S3

Types

data MinIOContextOptions Source #

Constructors

MinIOContextOptions 

Fields