2016-05-21 06:41:24 +00:00
|
|
|
module Main where
|
|
|
|
|
|
|
|
import Database.MongoDB.Admin (serverVersion)
|
|
|
|
import Database.MongoDB.Connection (connect, host)
|
|
|
|
import Database.MongoDB.Query (access, slaveOk)
|
|
|
|
import Data.Text (unpack)
|
|
|
|
import Test.Hspec.Runner
|
2017-04-09 17:20:10 +00:00
|
|
|
import System.Environment (getEnv)
|
|
|
|
import System.IO.Error (catchIOError)
|
|
|
|
import TestImport
|
2016-05-21 06:41:24 +00:00
|
|
|
import qualified Spec
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
2017-04-09 17:20:10 +00:00
|
|
|
mongodbHost <- getEnv mongodbHostEnvVariable `catchIOError` (\_ -> return "localhost")
|
|
|
|
p <- connect $ host mongodbHost
|
2016-05-21 06:41:24 +00:00
|
|
|
version <- access p slaveOk "admin" serverVersion
|
|
|
|
putStrLn $ "Running tests with mongodb version: " ++ (unpack version)
|
|
|
|
hspecWith defaultConfig Spec.spec
|