Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- redisSpec :: TestDefM (RedisServerHandle ': outers) Connection result -> TestDefM outers inner result
- redisConnectionSetupFunc :: RedisServerHandle -> SetupFunc Connection
- checkedConnectSetupFunc :: ConnectInfo -> SetupFunc Connection
- data RedisServerHandle = RedisServerHandle {
- redisServerHandleProcessHandle :: !(Process () () ())
- redisServerHandlePort :: !PortNumber
- redisServerSpec :: TestDefM (RedisServerHandle ': outers) inner result -> TestDefM outers inner result
- cleanRedisServerState :: Connection -> IO ()
- redisServerSetupFunc :: SetupFunc RedisServerHandle
- redisServerSetupFunc' :: Path Abs Dir -> SetupFunc RedisServerHandle
Documentation
redisSpec :: TestDefM (RedisServerHandle ': outers) Connection result -> TestDefM outers inner result Source #
Run a redis server around a group of test and provide a clean connection to every test
Example usage:
redisSpec $ do it "sets up and tears down a redis connection nicely" $ \conn -> do runRedis conn $ do errOrStatus <- Redis.set "hello" "world" liftIO $ case errOrStatus of Left err -> expectationFailure $ show err Right status -> status `shouldBe` Ok errOrReply <- Redis.get "hello" liftIO $ case errOrReply of Left err -> expectationFailure $ show err Right val -> val `shouldBe` Just "world"
This function just combines redisServerSpec
with setupAroundWith
redisConnectionSetupFunc'.
redisConnectionSetupFunc :: RedisServerHandle -> SetupFunc Connection Source #
Set up a clean redis connection given a handle to the redis server.
This function cleans the state using flushall
.
checkedConnectSetupFunc :: ConnectInfo -> SetupFunc Connection Source #
A SetupFunc
that bracket
s checkedConnect
and disconnect
.
data RedisServerHandle Source #
A handle to a child process that is a Redis server.
RedisServerHandle | |
|
redisServerSpec :: TestDefM (RedisServerHandle ': outers) inner result -> TestDefM outers inner result Source #
Run a redis server around a group of tests.
cleanRedisServerState :: Connection -> IO () Source #
Clean the redis server's state.
redisServerSetupFunc :: SetupFunc RedisServerHandle Source #
Setup func for running a Redis server
This function uses a temporary directory (using tempDirSetupFunc
) for any state.
redisServerSetupFunc' :: Path Abs Dir -> SetupFunc RedisServerHandle Source #
Setup func for running a Redis server in a given directory