Skip to content

Commit

Permalink
Merge pull request #45 from sourceboat/feature/28-integration-testing
Browse files Browse the repository at this point in the history
Integration testing with docker-compose.test.yml
  • Loading branch information
pehbehbeh authored Oct 22, 2020
2 parents e7a2406 + b4ce072 commit d44d2b5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.7'
services:
sut:
build: .
command: /root/test/test-command.sh
environment:
- STARTUP_COMMAND1=php --version
- STARTUP_COMMAND2=composer --version
- STARTUP_COMMAND3=chmod +x /root/test/test-command.sh
volumes:
- ./test:/root/test
2 changes: 2 additions & 0 deletions root/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -e

# make sure Laravel can write its own files
mkdir -p /opt/app/storage/logs/
mkdir -p /opt/app/bootstrap/cache

touch /opt/app/storage/logs/laravel.log
touch /opt/app/storage/logs/worker.log
chown www-data:www-data -R /opt/app/storage
Expand Down
15 changes: 15 additions & 0 deletions test/test-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e

# clean the app folder
cd /opt/
rm -rf app

# create laravel project into app
composer create-project --prefer-dist laravel/laravel app

# start services in the background
runsvdir /etc/service &

# check if the services are available
wait-for-it.sh --host=localhost --port=8080

0 comments on commit d44d2b5

Please sign in to comment.