Copyright | (c) 2020-2021 Tim Emiola |
---|---|
License | BSD3 |
Maintainer | Tim Emiola <adetokunbo@users.noreply.github.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Provides functions that make it easy to run Application
s
that access services running as tmp
procs
in integration tests.
Synopsis
- testWithApplication :: AreProcs procs => HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a
- testWithReadyApplication :: AreProcs procs => (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a
- testWithTLSApplication :: AreProcs procs => TLSSettings -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a
- testWithReadyTLSApplication :: AreProcs procs => TLSSettings -> (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a
- data ServerHandle procs
- serverPort :: ServerHandle procs -> Port
- handles :: AreProcs procs => ServerHandle procs -> HandlesOf procs
- shutdown :: AreProcs procs => ServerHandle procs -> IO ()
- runServer :: AreProcs procs => HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs)
- runReadyServer :: AreProcs procs => (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs)
- runTLSServer :: AreProcs procs => TLSSettings -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs)
- runReadyTLSServer :: AreProcs procs => TLSSettings -> (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs)
- checkHealth :: Int -> IO (Either a b) -> IO ()
Continuation-style setup
testWithApplication :: AreProcs procs => HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a Source #
Set up some ProcHandles
then run an Application
that uses them on a free
port.
Allows the app to configure itself using the tmp procs
, then provides a
callback with access to the handles.
The tmp procs
are shut down when the application is shut down.
testWithReadyApplication :: AreProcs procs => (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a Source #
Set up some ProcHandles
then run an Application
that uses them on a free
port.
Allows the app to configure itself using the tmp procs
, then provides a
callback with access to the handles.
Also runs a ready
action that to determine if the application started
correctly.
The tmp procs
are shut down when the application is shut down.
testWithTLSApplication :: AreProcs procs => TLSSettings -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a Source #
Like testWithApplication
, but the port is secured using a 'Warp.TLSSettings. '
testWithReadyTLSApplication :: AreProcs procs => TLSSettings -> (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a Source #
Like testWithReadyApplication
; the port is secured with TLSSettings
.
ServerHandle
data ServerHandle procs Source #
Represents a started Warp application and any AreProcs
dependencies.
serverPort :: ServerHandle procs -> Port Source #
The Port
on which the ServerHandle
s server is running.
handles :: AreProcs procs => ServerHandle procs -> HandlesOf procs Source #
The ServerHandle
sProcHandles
.
shutdown :: AreProcs procs => ServerHandle procs -> IO () Source #
Shuts down the ServerHandle
server and its tmp proc
dependencies.
runServer :: AreProcs procs => HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) Source #
Runs an Application
with ProcHandle
dependencies on a free port.
runReadyServer :: AreProcs procs => (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) Source #
Like runServer
; with an additional ready
that determines if the server is ready.'.
runTLSServer :: AreProcs procs => TLSSettings -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) Source #
Like runServer
; the port is secured with TLSSettings
.
runReadyTLSServer :: AreProcs procs => TLSSettings -> (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) Source #
Like runReadyServer
; the port is secured with TLSSettings
.