Skip to content

Commit

Permalink
Setup default image when cleaning up containers (#918)
Browse files Browse the repository at this point in the history
* setup default image when cleaning up containers
* update readme to run test
* Add md extension to tests README
---------
Co-authored-by: Polina Bungina <[email protected]>
  • Loading branch information
idanovinda authored Sep 7, 2023
1 parent 3343324 commit 353270a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
5 changes: 0 additions & 5 deletions postgres-appliance/tests/README

This file was deleted.

21 changes: 21 additions & 0 deletions postgres-appliance/tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Run tests

After building the image, you can test your image by:

1. Setting up the environment variable `SPILO_TEST_IMAGE` to test the specific image. If unset, the default will be `spilo`.
```
export SPILO_TEST_IMAGE=<your_spilo_image>
```
2. Run the test:
```
bash test_spilo.sh
```
To enable debugging for an entire script when it runs:
```
bash -x test_spilo.sh
```
The test will create multiple containers. They will be cleaned up by the last line before running `main` in `test_spilo.sh`. To keep and debug the containers after running the test, this part can be commented.
```
trap cleanup QUIT TERM EXIT
```
2 changes: 1 addition & 1 deletion postgres-appliance/tests/test_spilo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readonly TIMEOUT=120

function cleanup() {
stop_containers
docker ps -q --filter="ancestor=${SPILO_TEST_IMAGE}" --filter="name=${PREFIX}" | xargs docker rm -f
docker ps -q --filter="ancestor=${SPILO_TEST_IMAGE:-spilo}" --filter="name=${PREFIX}" | xargs docker rm -f
}

function get_non_leader() {
Expand Down

0 comments on commit 353270a

Please sign in to comment.