Skip to content

Commit

Permalink
integration tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bracyw committed Jan 6, 2025
1 parent 2f0b7c3 commit 4c8efb6
Showing 1 changed file with 33 additions and 11 deletions.
44 changes: 33 additions & 11 deletions scylla-server/integration_test.sh
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!"

0 comments on commit 4c8efb6

Please sign in to comment.