diff --git a/tests/docker/docker-compose.yml b/tests/docker/docker-compose.yml index 93e9455..28abcf3 100644 --- a/tests/docker/docker-compose.yml +++ b/tests/docker/docker-compose.yml @@ -48,6 +48,8 @@ services: main: build: . command: ["bash", "/app/tests/docker/run.sh"] + environment: + - INTERACTIVE_TEST_ENVIRONMENT=true volumes: - ../../:/app/ - /app/target/ diff --git a/tests/docker/run.sh b/tests/docker/run.sh index ae30c97..233dd3e 100644 --- a/tests/docker/run.sh +++ b/tests/docker/run.sh @@ -5,6 +5,27 @@ rm /app/*.profraw || true rm /app/pgcat.profdata || true rm -rf /app/cov || true +# Prepares the interactive test environment +# +if [ -n "$INTERACTIVE_TEST_ENVIRONMENT" ]; then + cargo build + LOG_LEVEL=error toxiproxy-server & + cd /app/tests/ruby + sudo bundle install + cd /app/tests/python + pip3 install -r tests/python/requirements.txt + echo "Interactive test environment ready" + echo "Run the following commands to start the tests:" + echo " docker compose exec main bash" + echo " cd /app/tests/ruby && sudo bundle exec ruby tests.rb --format documentation # Ruby tests" + echo " cd /app/tests/python && python3 tests.py # Python tests" + echo "You can rebuild PgCat from within the container by running" + echo " cargo build --release in /app" + echo "and then run the tests again" + sleep 100000000000000000 + exit 0 +fi + export LLVM_PROFILE_FILE="/app/pgcat-%m-%p.profraw" export RUSTC_BOOTSTRAP=1 export CARGO_INCREMENTAL=0