sydtest-hedis-0.0.0.0: An hedis companion library for sydtest
Safe HaskellNone
LanguageHaskell2010

Test.Syd.Redis

Synopsis

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.

data RedisServerHandle Source #

A handle to a child process that is a Redis server.

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