forked from torrust/torrust-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [torrust#342] broken E2E tests after renaming Category::category…
…_id field Some E2E tests were failing becuase a category field in a response was renamed. I have reestablished the old name `category_id`.
- Loading branch information
1 parent
e78607d
commit f8aa238
Showing
9 changed files
with
95 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# This script is only intended to be used for local development or testing environments. | ||
|
||
# Generate storage directory if it does not exist | ||
mkdir -p ./storage/index/lib/database | ||
|
||
# Generate the sqlite database if it does not exist | ||
if ! [ -f "./storage/index/lib/database/sqlite3.db" ]; then | ||
# todo: it should get the path from tracker.toml and only do it when we use sqlite | ||
sqlite3 ./storage/index/lib/database/sqlite3.db "VACUUM;" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
CURRENT_USER_NAME=$(whoami) | ||
CURRENT_USER_ID=$(id -u) | ||
echo "User name: $CURRENT_USER_NAME" | ||
echo "User id: $CURRENT_USER_ID" | ||
|
||
TORRUST_IDX_BACK_USER_UID=$CURRENT_USER_ID | ||
TORRUST_TRACKER_USER_UID=$CURRENT_USER_ID | ||
export TORRUST_IDX_BACK_USER_UID | ||
export TORRUST_TRACKER_USER_UID | ||
|
||
# todo: remove duplicate funtion | ||
wait_for_container_to_be_healthy() { | ||
local container_name="$1" | ||
local max_retries="$2" | ||
local retry_interval="$3" | ||
local retry_count=0 | ||
|
||
while [ $retry_count -lt "$max_retries" ]; do | ||
container_health="$(docker inspect --format='{{json .State.Health}}' "$container_name")" | ||
if [ "$container_health" != "{}" ]; then | ||
container_status="$(echo "$container_health" | jq -r '.Status')" | ||
if [ "$container_status" == "healthy" ]; then | ||
echo "Container $container_name is healthy" | ||
return 0 | ||
fi | ||
fi | ||
|
||
retry_count=$((retry_count + 1)) | ||
echo "Waiting for container $container_name to become healthy (attempt $retry_count of $max_retries)..." | ||
sleep "$retry_interval" | ||
done | ||
|
||
echo "Timeout reached, container $container_name is not healthy" | ||
return 1 | ||
} | ||
|
||
# Install tool to create torrent files. | ||
# It's needed by some tests to generate and parse test torrent files. | ||
cargo install imdl || exit 1 | ||
|
||
# Install app (no docker) that will run the test suite against the E2E testing | ||
# environment (in docker). | ||
cp .env.local .env || exit 1 | ||
./contrib/dev-tools/container/e2e/sqlite/install.sh || exit 1 | ||
|
||
# TEST USING SQLITE | ||
echo "Running E2E tests using SQLite ..." | ||
|
||
# Start E2E testing environment | ||
./contrib/dev-tools/container/e2e/sqlite/e2e-env-up.sh || exit 1 | ||
|
||
wait_for_container_to_be_healthy torrust-mysql-1 10 3 | ||
# todo: implement healthchecks for tracker and index and wait until they are healthy | ||
#wait_for_container torrust-tracker-1 10 3 | ||
#wait_for_container torrust-idx-back-1 10 3 | ||
sleep 20s | ||
|
||
# Just to make sure that everything is up and running | ||
docker ps | ||
|
||
# Run E2E tests with shared app instance | ||
TORRUST_INDEX_E2E_SHARED=true TORRUST_INDEX_E2E_PATH_CONFIG="./share/default/config/index.container.sqlite3.toml" cargo test || exit 1 | ||
|
||
# Stop E2E testing environment | ||
./contrib/dev-tools/container/e2e/sqlite/e2e-env-down.sh || exit 1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters