Skip to content

Commit

Permalink
chore: update test script
Browse files Browse the repository at this point in the history
  • Loading branch information
ParzivalEugene committed Aug 9, 2024
1 parent a3857ac commit 9298d64
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 136 deletions.
129 changes: 0 additions & 129 deletions docker-compose-dev.yml

This file was deleted.

19 changes: 19 additions & 0 deletions src/tests/e2e/scripts/test-full-reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
original_dir=$(pwd)
function return_to_original_dir {
cd "$original_dir"
}
trap return_to_original_dir EXIT
cd "$(git rev-parse --show-toplevel)"

docker compose --env-file .env.test -f docker-compose-test.yml up -d
sleep 2

psql postgresql://helios:123456789@localhost:5555/heliosdb -f migrations/00000000000000_diesel_initial_setup/up.sql
psql postgresql://helios:123456789@localhost:5555/heliosdb -f migrations/2024-08-02-114025_initial/up.sql
psql postgresql://helios:123456789@localhost:5555/heliosdb -f src/tests/e2e/sql/seed.sql

cargo test e2e

docker compose -f docker-compose-test.yml down

cd "$original_dir"
18 changes: 12 additions & 6 deletions src/tests/e2e/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ function return_to_original_dir {
trap return_to_original_dir EXIT
cd "$(git rev-parse --show-toplevel)"

docker compose --env-file .env.test -f docker-compose-test.yml up -d
sleep 2
CONTAINER_NAME=test-database

psql postgresql://helios:123456789@localhost:5555/heliosdb -f migrations/00000000000000_diesel_initial_setup/up.sql
psql postgresql://helios:123456789@localhost:5555/heliosdb -f migrations/2024-08-02-114025_initial/up.sql
psql postgresql://helios:123456789@localhost:5555/heliosdb -f src/tests/e2e/sql/seed.sql
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo "Container $CONTAINER_NAME is already running."
else
docker compose --env-file .env.test -f docker-compose-test.yml up -d
sleep 2
fi

psql postgresql://helios:123456789@localhost:5555/heliosdb -f migrations/00000000000000_diesel_initial_setup/up.sql > /dev/null
psql postgresql://helios:123456789@localhost:5555/heliosdb -f migrations/2024-08-02-114025_initial/up.sql > /dev/null
psql postgresql://helios:123456789@localhost:5555/heliosdb -f src/tests/e2e/sql/seed.sql > /dev/null

cargo test e2e

docker compose -f docker-compose-test.yml down
psql postgresql://helios:123456789@localhost:5555/heliosdb -f src/tests/e2e/sql/dump.sql > /dev/null

cd "$original_dir"
4 changes: 3 additions & 1 deletion src/tests/e2e/sql/dump.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
DELETE FROM "session";
DELETE FROM "device";
DELETE FROM "classic_auth";
DELETE FROM "oauth";
DELETE FROM "config";
DELETE FROM "server";
DELETE FROM "user";
DELETE FROM "user";
1 change: 1 addition & 0 deletions src/tests/unit/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 9298d64

Please sign in to comment.