-
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.
- Loading branch information
Showing
1 changed file
with
33 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
#!/bin/sh | ||
echo "Starting db" | ||
cd ../compose | ||
docker compose up -d odyssey-timescale | ||
|
||
cd ../scylla-server | ||
echo "Migrating DB" | ||
diesel migration run | ||
# Navigate to the compose directory | ||
echo "Navigating to compose directory..." | ||
cd ../compose || { echo "Compose directory not found"; exit 1; } | ||
|
||
echo "Running tests" | ||
DATABASE_URL=postgresql://postgres:[email protected]:5432/postgres cargo test -- --test-threads=1 | ||
# Remove any existing odyssey-timescale container | ||
echo "Stopping and removing any existing odyssey-timescale container..." | ||
docker rm -f odyssey-timescale 2>/dev/null || echo "No existing container to remove." | ||
|
||
echo "Exiting" | ||
cd ../compose | ||
docker compose down | ||
# Start a new odyssey-timescale container | ||
echo "Starting a new odyssey-timescale container..." | ||
docker compose up -d odyssey-timescale || { echo "Failed to start odyssey-timescale"; exit 1; } | ||
|
||
# Wait for the database to initialize | ||
echo "Waiting for the database to initialize..." | ||
sleep 3 | ||
|
||
# Navigate to the scylla-server directory | ||
cd ../scylla-server || { echo "scylla-server directory not found"; exit 1; } | ||
|
||
# Run database migrations | ||
echo "Running database migrations..." | ||
DATABASE_URL=postgresql://postgres:[email protected]:5432/postgres diesel migration run || { echo "Migration failed"; exit 1; } | ||
|
||
# Run tests | ||
echo "Running tests..." | ||
DATABASE_URL=postgresql://postgres:[email protected]:5432/postgres cargo test -- --test-threads=1 || { echo "Tests failed"; exit 1; } | ||
|
||
# Navigate back to the compose directory | ||
cd ../compose || { echo "Compose directory not found"; exit 1; } | ||
|
||
# Stop and clean up containers | ||
echo "Stopping and cleaning up containers..." | ||
docker compose down || { echo "Failed to clean up containers"; exit 1; } | ||
|
||
echo "Script completed successfully!" |