Skip to content

Commit d44d2b5

Browse files
authored
Merge pull request #45 from sourceboat/feature/28-integration-testing
Integration testing with docker-compose.test.yml
2 parents e7a2406 + b4ce072 commit d44d2b5

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

docker-compose.test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.7'
2+
services:
3+
sut:
4+
build: .
5+
command: /root/test/test-command.sh
6+
environment:
7+
- STARTUP_COMMAND1=php --version
8+
- STARTUP_COMMAND2=composer --version
9+
- STARTUP_COMMAND3=chmod +x /root/test/test-command.sh
10+
volumes:
11+
- ./test:/root/test

root/entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set -e
55

66
# make sure Laravel can write its own files
77
mkdir -p /opt/app/storage/logs/
8+
mkdir -p /opt/app/bootstrap/cache
9+
810
touch /opt/app/storage/logs/laravel.log
911
touch /opt/app/storage/logs/worker.log
1012
chown www-data:www-data -R /opt/app/storage

test/test-command.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# clean the app folder
5+
cd /opt/
6+
rm -rf app
7+
8+
# create laravel project into app
9+
composer create-project --prefer-dist laravel/laravel app
10+
11+
# start services in the background
12+
runsvdir /etc/service &
13+
14+
# check if the services are available
15+
wait-for-it.sh --host=localhost --port=8080

0 commit comments

Comments
 (0)