Skip to content

Commit c3162dc

Browse files
author
Corin Lawson
committed
Drop dependency on p2
Prior to this change, the test-smoke script required the p2 binary to augment the Dockerfile under docker-postgres-replication. I do not have that binary on my system, nor was I able to find an installer for it. The closest tool I found was p2cli, but even that did not work as expected. This change removes the Dockerfile.p2 file in favour of using Docker's builtin build args mechanism to augment the docker build. Signed-off-by: Corin Lawson <[email protected]>
1 parent 1c4cc30 commit c3162dc

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

cmd/postgres_exporter/tests/docker-postgres-replication/Dockerfile

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM postgres:11
1+
ARG VERSION
2+
FROM postgres:$VERSION
23
MAINTAINER Daniel Dent (https://www.danieldent.com)
34
ENV PG_MAX_WAL_SENDERS 8
45
ENV PG_WAL_KEEP_SEGMENTS 8

cmd/postgres_exporter/tests/docker-postgres-replication/Dockerfile.p2

Lines changed: 0 additions & 8 deletions
This file was deleted.

cmd/postgres_exporter/tests/docker-postgres-replication/docker-compose.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ version: '2'
33

44
services:
55
pg-master:
6-
build: '.'
6+
build:
7+
context: '.'
8+
args:
9+
VERSION: $VERSION
710
image: 'danieldent/postgres-replication'
811
restart: 'always'
912
environment:
@@ -16,7 +19,10 @@ services:
1619
- '5432'
1720

1821
pg-slave:
19-
build: '.'
22+
build:
23+
context: '.'
24+
args:
25+
VERSION: $VERSION
2026
image: 'danieldent/postgres-replication'
2127
restart: 'always'
2228
environment:

cmd/postgres_exporter/tests/test-smoke

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,9 @@ smoketest_postgres() {
129129
echo "#######################"
130130
old_pwd=$(pwd)
131131
cd docker-postgres-replication || exit 1
132-
133-
if ! VERSION="$version" p2 -t Dockerfile.p2 -o Dockerfile ; then
134-
echo "Templating failed" 1>&2
135-
exit 1
136-
fi
132+
137133
trap "docker-compose logs; docker-compose down ; docker-compose rm -v; exit 1" EXIT INT TERM
138-
local compose_cmd="POSTGRES_PASSWORD=$POSTGRES_PASSWORD docker-compose up -d --force-recreate --build"
134+
local compose_cmd="VERSION=$version POSTGRES_PASSWORD=$POSTGRES_PASSWORD docker-compose up -d --force-recreate --build"
139135
echo "Compose Cmd: $compose_cmd"
140136
eval "$compose_cmd"
141137

0 commit comments

Comments
 (0)