Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- withContainers :: forall a. TestContainer a -> (a -> IO ()) -> IO ()
- module TestContainers
Running containers for tests
withContainers :: forall a. TestContainer a -> (a -> IO ()) -> IO () Source #
Allow Spec
to depend on Docker containers. Hspec takes care of
initialization and de-initialization of the containers.
containers :: MonadDocker m => m Boolean
containers = do
_redis <- TestContainers.run $ TestContainers.containerRequest TestContainers.redis
_kafka <- TestContainers.run $ TestContainers.containerRequest TestContainers.kafka
pure True
example :: Spec
example =
around (withContainers containers) $ describe "Example tests"
it "first test" $ \isBoolean -> do
isBoolean shouldBe
True
withContainers
allows you naturally scope the handling of containers for your tests.
Re-exports for convenience
module TestContainers