Add docker-compose file to run tests (#1463)

This commit is contained in:
Wolfgang Walther
2020-03-24 09:50:06 -05:00
committed by GitHub
parent fe59f9bedf
commit a80eb2ff0e
3 changed files with 32 additions and 2 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ ENV PATH /root/.local/bin:$PATH
RUN apt-get update \
&& apt-get install -y wget libpq-dev pkg-config libpcre3 libpcre3-dev \
postgresql-client debconf locales \
postgresql-client debconf locales build-essential libffi-dev libgmp-dev git \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen \
&& locale-gen \
+1 -1
View File
@@ -160,7 +160,7 @@ analyzeTable dbConn tableName =
loadFixture :: Text -> FilePath -> IO()
loadFixture dbConn name =
void $ readProcess "psql" ["--set", "ON_ERROR_STOP=1", toS dbConn, "-a", "-f", "test/fixtures/" ++ name ++ ".sql"] []
void $ readProcess "psql" ["--set", "ON_ERROR_STOP=1", toS dbConn, "-q", "-f", "test/fixtures/" ++ name ++ ".sql"] []
rangeHdrs :: ByteRange -> [Header]
rangeHdrs r = [rangeUnit, (hRange, renderByteRange r)]
+30
View File
@@ -0,0 +1,30 @@
version: "3.6"
services:
test:
build:
context: .
dockerfile: Dockerfile.test
depends_on:
- postgres
working_dir: /root/postgrest
volumes:
- ../:/root/postgrest
- stack-linux:/root/.stack
- stack-work:/root/postgrest/.stack-work
command: bash -c "POSTGREST_TEST_CONNECTION=$$(test/create_test_db 'postgres://postgres:postgres@postgres' test_db) stack test"
postgres:
image: postgres:11
environment:
POSTGRES_PASSWORD: postgres
volumes:
- postgres:/var/lib/postgresql/data
volumes:
postgres:
driver_opts:
type: tmpfs
device: tmpfs
stack-linux:
stack-work: