Remove connection pooling in test

This commit is contained in:
Joe Nelson
2016-01-24 18:09:19 -08:00
parent 8b13e7dd73
commit ac73e8d77b
2 changed files with 4 additions and 7 deletions
+4 -3
View File
@@ -3,10 +3,11 @@ module Main where
import Test.Hspec
import SpecHelper
import Data.Pool
import qualified Hasql.Session as H
import qualified Hasql.Connection as H
import PostgREST.DbStructure (getDbStructure)
import Data.String.Conversions (cs)
import qualified Feature.AuthSpec
import qualified Feature.CorsSpec
@@ -21,14 +22,14 @@ main :: IO ()
main = do
setupDb
pool <- testPool
withResource pool $ \case
H.acquire (cs dbString) >>= \case
Left err -> error $ show err
Right c -> do
dbOrErr <- H.run (getDbStructure "test") c
-- Not using hspec-discover because we want to precompute
-- the db structure and pass it to specs for speed
either (error.show) (hspec . specs c) dbOrErr
H.release c
where
specs conn dbStructure = do
-4
View File
@@ -84,7 +84,3 @@ authHeaderBasic u p =
authHeaderJWT :: String -> Header
authHeaderJWT token =
(hAuthorization, cs $ "Bearer " ++ token)
testPool :: IO (Pool (Either H.ConnectionError H.Connection))
testPool = createPool (H.acquire . cs $ dbString)
(either (const $ return ()) H.release) 1 1 1