From cf342648cdbe6fae1a8c1e7cb8847917052ce544 Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Tue, 25 Jul 2017 13:15:40 -0500 Subject: [PATCH] Minor test cleanup --- .travis.yml | 4 ++-- Makefile | 15 +++++++++++++++ test/Test.hs | 8 ++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5525102..fa11b80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,8 @@ install: - export PATH=$HOME/.local/bin:$PATH - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' - stack --version - - createuser -s --no-password test - - createdb -O test test + - echo "CREATE USER esqutest WITH PASSWORD 'esqutest';" | sudo -u postgres psql + - sudo -u postgres createdb -O esqutest esqutest script: - stack setup diff --git a/Makefile b/Makefile index 1e78236..3a13402 100644 --- a/Makefile +++ b/Makefile @@ -12,5 +12,20 @@ ghci: test: stack test +test-postgresql: + stack test --flag esqueleto:postgresql + +test-mysql: + stack test --flag esqueleto:mysql + test-ghci: stack ghci esqueleto:test:test + +# sudo -u postgres createuser -s - esqueleto-test +reset-pgsql: + -sudo -u postgres dropdb esqutest + -sudo -u postgres dropuser esqutest + echo "CREATE USER esqutest WITH PASSWORD 'esqutest';" | sudo -u postgres psql + sudo -u postgres createdb -O esqutest esqutest + +.PHONY: build build-7.10 build-8.0 ghci test test-ghci diff --git a/test/Test.hs b/test/Test.hs index 28aaf77..2eadc53 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -1528,13 +1528,13 @@ withConn :: RunDbMonad m => (SqlBackend -> R.ResourceT m a) -> m a withConn = R.runResourceT . #if defined(WITH_POSTGRESQL) - withPostgresqlConn "host=localhost port=5432 user=test dbname=test" + withPostgresqlConn "host=localhost port=5432 user=esqutest password=esqutest dbname=esqutest" #elif defined (WITH_MYSQL) withMySQLConn defaultConnectInfo { connectHost = "localhost" - , connectUser = "test" - , connectPassword = "test" - , connectDatabase = "test" + , connectUser = "esqutest" + , connectPassword = "esqutest" + , connectDatabase = "esqutest" } #else withSqliteConn ":memory:"