Skip to content

Commit 3c93cd2

Browse files
Add docker files for local test environment (#250)
Add a `DockerFile` and compose file, along with instructions for running it to simplify testing.
1 parent a760d7c commit 3c93cd2

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Revision history for pgTAP
2828
for the report (#277).
2929
* Added `isnt_member_of()` (#38, #204). Thanks to Wolfgang Walther for the
3030
pull request (#249).
31+
* Added docker files for local test environment. Thanks to Wolfgang Walther for
32+
the pull request (#250).
3133

3234
1.1.0 2019-11-25T19:05:38Z
3335
--------------------------

doc/pgtap.mmd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ You can use it to run the test suite as a database super user like so:
152152

153153
make test PGUSER=postgres
154154

155+
To run the tests in a local docker environment for development, run:
156+
157+
cd test
158+
docker-compose build test
159+
# start the postgres server in a docker container in the background
160+
docker-compose up -d test
161+
# run the regression tests
162+
docker-compose exec test make install installcheck
163+
# run the tests with pg_proove
164+
# "run" builds and installs pgTAP, runs "CREATE EXTENSION"
165+
# and then runs make test
166+
docker-compose exec test run
167+
155168
Adding pgTAP to a Database
156169
--------------------------
157170

test/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM postgres:13.0-alpine
2+
ENV POSTGRES_HOST_AUTH_METHOD trust
3+
4+
RUN apk --no-cache add make perl-dev patch \
5+
&& cpan TAP::Parser::SourceHandler::pgTAP
6+
ENV PGUSER postgres
7+
8+
WORKDIR /pgtap
9+
ENV PATH /pgtap/test:$PATH

test/docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: "3"
2+
3+
services:
4+
test:
5+
build: .
6+
volumes:
7+
- ../:/pgtap
8+
- postgres:/var/lib/postgresql/data
9+
10+
volumes:
11+
postgres:
12+
driver_opts:
13+
type: tmpfs
14+
device: tmpfs
15+

test/run

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env sh
2+
3+
set -e -u -o pipefail
4+
5+
make install
6+
psql -Ec 'DROP EXTENSION IF EXISTS pgtap; CREATE EXTENSION pgtap;'
7+
make test

0 commit comments

Comments
 (0)