Skip to content

Commit 0b29678

Browse files
committed
refactor(ci): reorganize E2E testing scripts
1 parent 22b8f8a commit 0b29678

File tree

12 files changed

+43
-83
lines changed

12 files changed

+43
-83
lines changed

.github/workflows/develop.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
- uses: taiki-e/install-action@nextest
3030
- name: Test Coverage
3131
run: cargo llvm-cov nextest
32-
- name: E2E Tests with SQLite
33-
run: ./docker/bin/run-e2e-tests.sh
34-
- name: E2E Tests with MySQL
35-
run: ./docker/bin/e2e/mysql/run-e2e-tests.sh
32+
- name: E2E Tests
33+
run: ./docker/bin/e2e/run-e2e-tests.sh
34+

docker/bin/e2e-env-down.sh

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

docker/bin/e2e-env-restart.sh

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

docker/bin/e2e/mysql/e2e-env-down.sh

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

docker/bin/e2e/mysql/e2e-env-reset.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22

3-
./docker/bin/e2e/mysql/e2e-env-down.sh
4-
53
# Delete the databases and recreate them.
64

5+
docker compose down
6+
77
# Index Backend
88

99
# Database credentials
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

3-
./docker/bin/e2e/mysql/e2e-env-down.sh
3+
docker compose down
44
./docker/bin/e2e/mysql/e2e-env-up.sh
Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,39 @@ wait_for_container_to_be_healthy() {
3535
return 1
3636
}
3737

38-
# Install tool to create torrent files
38+
# Install tool to create torrent files.
39+
# It's needed by some tests to generate and parse test torrent files.
3940
cargo install imdl || exit 1
4041

42+
# Install app (no docker) that will run the test suite against the E2E testing
43+
# environment (in docker).
4144
cp .env.local .env || exit 1
4245
./bin/install.sh || exit 1
4346

47+
# TEST USING SQLITE
48+
echo "Running E2E tests using SQLite ..."
49+
50+
# Start E2E testing environment
51+
./docker/bin/e2e/sqlite/e2e-env-up.sh || exit 1
52+
53+
wait_for_container_to_be_healthy torrust-mysql-1 10 3
54+
# todo: implement healthchecks for tracker and backend and wait until they are healthy
55+
#wait_for_container torrust-tracker-1 10 3
56+
#wait_for_container torrust-idx-back-1 10 3
57+
sleep 20s
58+
59+
# Just to make sure that everything is up and running
60+
docker ps
61+
62+
# Run E2E tests with shared app instance
63+
TORRUST_IDX_BACK_E2E_SHARED=true TORRUST_IDX_BACK_E2E_CONFIG_PATH="./config-idx-back.sqlite.local.toml" cargo test || exit 1
64+
65+
# Stop E2E testing environment
66+
docker compose down
67+
68+
# TEST USING MYSQL
69+
echo "Running E2E tests using MySQL ..."
70+
4471
# Start E2E testing environment
4572
./docker/bin/e2e/mysql/e2e-env-up.sh || exit 1
4673

@@ -67,4 +94,4 @@ mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASSWORD -e "CREATE DATABASE IF NOT
6794
TORRUST_IDX_BACK_E2E_SHARED=true TORRUST_IDX_BACK_E2E_CONFIG_PATH="./config-idx-back.mysql.local.toml" cargo test || exit 1
6895

6996
# Stop E2E testing environment
70-
./docker/bin/e2e/mysql/e2e-env-down.sh
97+
docker compose down
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

3-
# Delete the SQLite databases and recreate them.
3+
# Delete the databases and recreate them.
44

5-
./docker/bin/e2e-env-down.sh
5+
docker compose down
66

77
rm -f ./storage/database/torrust_index_backend_e2e_testing.db
88
rm -f ./storage/database/torrust_tracker_e2e_testing.db
@@ -23,4 +23,4 @@ if ! [ -f "./storage/database/torrust_tracker_e2e_testing.db" ]; then
2323
echo ";" | sqlite3 ./storage/database/torrust_tracker_e2e_testing.db
2424
fi
2525

26-
./docker/bin/e2e-env-up.sh
26+
./docker/bin/e2e/sqlite/e2e-env-up.sh
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker compose down
4+
./docker/bin/e2e/sqlite/e2e-env-up.sh

0 commit comments

Comments
 (0)