-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some restart tests #166
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
20b3279
Add some restart tests
djdefi 57a2501
new logic for init
djdefi de402c1
Merge branch 'master' into restart-tests
djdefi dcd78da
more tests
djdefi a3c2703
make restarts not 500
djdefi f8f30c4
Merge branch 'master' into restart-tests
djdefi cbc2a89
mysql test suite
djdefi fb3fb2c
Merge branch 'restart-tests' of github.com:CachetHQ/Docker into resta…
djdefi a94a1f8
allow db port override for mysql / pgsql
djdefi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ before_install: | |
|
||
script: | ||
- bats test/test.full.bats | ||
- bats test/test.mysql.bats | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: "2" | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=mysql | ||
- MYSQL_USER=mysql | ||
- MYSQL_PASSWORD=mysql | ||
- MYSQL_DATABASE=mysql | ||
cachet: | ||
image: docker_cachet | ||
ports: | ||
- 80:80 | ||
links: | ||
- mysql:mysql | ||
environment: | ||
- DB_DRIVER=mysql | ||
- DB_HOST=mysql | ||
- DB_DATABASE=mysql | ||
- DB_USERNAME=mysql | ||
- DB_PASSWORD=mysql | ||
depends_on: | ||
- mysql | ||
|
||
networks: | ||
default: | ||
external: | ||
name: docker_default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/usr/bin/env bats | ||
load test_helpers | ||
load docker_helpers | ||
load "lib/batslib" | ||
load "lib/output" | ||
|
||
@test "[$TEST_FILE] docker-compose up" { | ||
command docker-compose -f test/docker-compose-mysql.yml up -d | ||
} | ||
|
||
@test "[$TEST_FILE] check for container init" { | ||
docker_wait_for_log test_cachet_1 15 "Initializing Cachet container ..." | ||
} | ||
|
||
@test "[$TEST_FILE] check for database startup" { | ||
docker_wait_for_log test_mysql_1 120 "[Note] mysqld: ready for connections." | ||
} | ||
|
||
@test "[$TEST_FILE] check for empty sessions table" { | ||
docker_wait_for_log test_cachet_1 15 "Table sessions does not exist! ..." | ||
} | ||
|
||
@test "[$TEST_FILE] check for DB init" { | ||
docker_wait_for_log test_cachet_1 15 "Initializing Cachet database ..." | ||
} | ||
|
||
@test "[$TEST_FILE] check for populated sessions table" { | ||
docker_wait_for_log test_cachet_1 15 "Table sessions exists! ..." | ||
} | ||
|
||
@test "[$TEST_FILE] check for container start message" { | ||
docker_wait_for_log test_cachet_1 15 "Starting Cachet! ..." | ||
} | ||
|
||
@test "[$TEST_FILE] check for nginx startup" { | ||
docker_wait_for_log test_cachet_1 15 "INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)" | ||
} | ||
|
||
@test "[$TEST_FILE] check for php-fpm startup" { | ||
docker_wait_for_log test_cachet_1 15 "INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)" | ||
} | ||
|
||
@test "[$TEST_FILE] php artisan cachet:seed" { | ||
run docker exec test_cachet_1 php artisan cachet:seed | ||
assert_output -l 0 $'Database seeded with demo data successfully!' | ||
} | ||
|
||
@test "[$TEST_FILE] curl 200 response test" { | ||
run curl_container test_cachet_1 /auth/login --head | ||
assert_output -l 0 $'HTTP/1.1 200 OK\r' | ||
} | ||
|
||
@test "[$TEST_FILE] login test" { | ||
run curl_container test_cachet_1 /auth/login --head --user test:test123 | ||
assert_output -l 0 $'HTTP/1.1 200 OK\r' | ||
} | ||
|
||
@test "[$TEST_FILE] check for curl API pong" { | ||
run curl_container test_cachet_1 /api/v1/ping | ||
assert_output -l 0 $'{"data":"Pong!"}' | ||
} | ||
|
||
@test "[$TEST_FILE] restart cachet" { | ||
command docker-compose -f test/docker-compose-mysql.yml stop cachet | ||
command docker-compose -f test/docker-compose-mysql.yml rm -f cachet | ||
command docker-compose -f test/docker-compose-mysql.yml up -d | ||
docker_wait_for_log test_cachet_1 15 "INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)" | ||
} | ||
|
||
@test "[$TEST_FILE] post-restart API pong" { | ||
run curl_container test_cachet_1 /api/v1/ping | ||
assert_output -l 0 $'{"data":"Pong!"}' | ||
} | ||
|
||
@test "[$TEST_FILE] post-restart login test" { | ||
run curl_container test_cachet_1 /auth/login --head --user test:test123 | ||
assert_output -l 0 $'HTTP/1.1 200 OK\r' | ||
} | ||
|
||
@test "[$TEST_FILE] stop all test containers" { | ||
stop_bats_containers | ||
} | ||
|
||
@test "[$TEST_FILE] Cleanup test containers" { | ||
docker_clean test_cachet_1 | ||
docker_clean test_mysql_1 | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize a key is being shipped here, but it needed some real default value for now. This should be set via
-e APP_KEY="base64:<Your Real Key>"
in production anyway.