A tool to run queries against postgres and check for an expected result
1.5K
A tool to run queries against postgres and check for an expected result.
While writing postgres software that manages objects in Postgres (like pgfga), we needed a tool for easy integration testing. As an integration test we just wanted to create an environment with Postgres, the tool, (and other components as required), run the tool and check the outcome in postgres. We decided to build a tool which can run defined queries against Postgres, and check for expected results. And thus pgtester was born.
For container environments pgtester is also available on dockerhub. Using it would be as easy as:
cat testdata/pgtester/tests.yaml | docker run -i mannemsolutions/pgtester pgtester
You can use pgtester with docker compose. The docker-compose.yml file could have contents like this:
services:
pgtester:
image: mannemsolutions/pgtester
command: pgtester /etc/pgtestdata/examples/tests1.yaml
postgres:
image: postgres:13
environment:
POSTGRES_HOST_AUTH_METHOD: 'md5'
POSTGRES_PASSWORD: pgtester
leveraging pgtester could be as easy as:
docker-compose up
or (with only output for pgtester):
docker-compose up -d postgres
docker-compose up pgtester
or (with tests defined locally):
docker-compose up -d postgres
cat ./mytests*.yml | docker-compose up pgtester
For more info, refer to:
Content type
Image
Digest
sha256:8fe7b34a8…
Size
9.1 MB
Last updated
about 2 years ago
docker pull mannemsolutions/pgtester