Skip to content

Commit

Permalink
Modify to run test on pgsql
Browse files Browse the repository at this point in the history
  • Loading branch information
Menzo Wijmenga committed Mar 23, 2021
1 parent 09e1362 commit e0b7a7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ docker-compose up -d

echo "Waiting for services to boot ..."

if docker run -it --rm registry.gitlab.com/grahamcampbell/php:7.4-base -r "\$tries = 0; while (true) { try { \$tries++; if (\$tries > 30) { throw new RuntimeException('MySQL never became available'); } sleep(1); new PDO('mysql:host=docker.for.mac.localhost;dbname=forge', 'root', '', [PDO::ATTR_TIMEOUT => 3]); break; } catch (PDOException \$e) {} }"; then
if docker run -it --rm registry.gitlab.com/grahamcampbell/php:7.4-base -r "\$tries = 0; while (true) { try { \$tries++; if (\$tries > 30) { throw new RuntimeException('PsQL never became available'); } sleep(1); new PDO('pgsql:host=docker.for.mac.localhost;port=5432;dbname=forge;user=root', 'root', 'root', [PDO::ATTR_TIMEOUT => 3]); break; } catch (PDOException \$e) {} }"; then
if docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit \
--env CI=1 --env DB_HOST=docker.for.mac.localhost --env DB_USERNAME=root \
--env CI=1 --env DB_HOST=docker.for.mac.localhost --env DB_USERNAME=root --env DB_PORT=5432 \
--env DB_CONNECTION=pgsql --env DB_PASSWORD=root \
--env REDIS_HOST=docker.for.mac.localhost --env REDIS_PORT=6379 \
--env MEMCACHED_HOST=docker.for.mac.localhost --env MEMCACHED_PORT=11211 \
--rm registry.gitlab.com/grahamcampbell/php:7.4-base "$@"; then
Expand Down
19 changes: 11 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ services:
ports:
- "11211:11211"
restart: always
mysql:
image: mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_ROOT_PASSWORD: ""
MYSQL_DATABASE: "forge"
ports:
- "3306:3306"

pgsql:
container_name: postgres
image: postgres
restart: always
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: root
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: root
POSTGRES_DB: "forge"
redis:
image: redis:5.0-alpine
ports:
Expand Down

0 comments on commit e0b7a7b

Please sign in to comment.