diff --git a/test/Dockerfile.test b/test/Dockerfile.test index 116ce2393..7a04c3254 100644 --- a/test/Dockerfile.test +++ b/test/Dockerfile.test @@ -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 \ diff --git a/test/SpecHelper.hs b/test/SpecHelper.hs index 013389e90..40f158da7 100644 --- a/test/SpecHelper.hs +++ b/test/SpecHelper.hs @@ -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)] diff --git a/test/docker-compose.yml b/test/docker-compose.yml new file mode 100644 index 000000000..b6d517e27 --- /dev/null +++ b/test/docker-compose.yml @@ -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: