Skip to content

Commit

Permalink
Merge pull request #3055 from TracksApp/fix_tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
ZeiP authored Oct 23, 2024
2 parents 8abfafa + e4f3fd0 commit e829dac
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions script/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

export RUBY_VERSION=$1

docker_compose="docker-compose --file test-envs/docker-compose-$2.yml"
docker_compose="docker compose --file test-envs/docker-compose-$2.yml"

function cleanup() {
$docker_compose down
Expand All @@ -22,7 +22,7 @@ export DATABASE_NAME=tracks_test

$docker_compose build
$docker_compose up -d
script/poll-for-db
script/poll-for-db $2

# Leaving this in since it will be needed for Rails 5
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
Expand Down
2 changes: 1 addition & 1 deletion script/docker-environment
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

docker_compose="docker-compose --file docker-compose.yml"
docker_compose="docker compose --file docker-compose.yml"

# Find our app dir
appdir=$(cd $(dirname "$0")/.. && pwd)
Expand Down
3 changes: 2 additions & 1 deletion script/poll-for-db
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

echo "==> Polling DB…"

if [ "$DATABASE_TYPE" == "mysql" ]; then
if [ "$1" == "mysql" ]; then
appdir=$(cd $(dirname "$0")/.. && pwd)
[ -f /etc/app-env ] || exec "$appdir/script/docker-environment" $0 $@

for i in {1..60}; do
echo "... Checking for connection"
nc -z -w5 db 3306 && exit
sleep 1
done
Expand Down
3 changes: 1 addition & 2 deletions test-envs/docker-compose-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
db:
image: mysql:5.7
Expand All @@ -12,7 +11,7 @@ services:
args:
RUBY_VERSION: ${RUBY_VERSION}
environment:
# These are set in script/ci-build, so we need to pass-thru them.
# These are set in script/cibuild, so we need to pass-thru them.
RAILS_ENV: $RAILS_ENV
DATABASE_NAME: $DATABASE_NAME
DATABASE_USERNAME: root
Expand Down
3 changes: 1 addition & 2 deletions test-envs/docker-compose-postgres.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
db:
image: postgres:13
Expand All @@ -12,7 +11,7 @@ services:
args:
RUBY_VERSION: ${RUBY_VERSION}
environment:
# These are set in script/ci-build, so we need to pass-thru them.
# These are set in script/cibuild, so we need to pass-thru them.
RAILS_ENV: $RAILS_ENV
DATABASE_NAME: $DATABASE_NAME
DATABASE_USERNAME: postgres
Expand Down
3 changes: 1 addition & 2 deletions test-envs/docker-compose-sqlite.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
web:
build:
Expand All @@ -7,7 +6,7 @@ services:
args:
RUBY_VERSION: ${RUBY_VERSION}
environment:
# These are set in script/ci-build, so we need to pass-thru them.
# These are set in script/cibuild, so we need to pass-thru them.
RAILS_ENV: $RAILS_ENV
DATABASE_NAME: "/app/db/db.sqlite"
DATABASE_TYPE: sqlite3
Expand Down

0 comments on commit e829dac

Please sign in to comment.