-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
47 deletions.
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
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,18 @@ | ||
name: smoke-test | ||
description: runs smoke tests | ||
|
||
inputs: | ||
url: | ||
description: The URL of the deployed environment. | ||
required: true | ||
current-commit-sha: | ||
description: The sha of the current commit | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Run smoke tests | ||
shell: bash | ||
run: bin/smoke ${{ inputs.url }} ${{ inputs.current-commit-sha }} |
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 |
---|---|---|
@@ -1,8 +1,33 @@ | ||
#!/usr/bin/env sh | ||
# | ||
# Application smoke test script | ||
# | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
url=$1 | ||
if [[ -z $url ]]; then | ||
echo `date`" - smoke test failed (URL is missing)" | ||
exit 1 | ||
fi | ||
response=$(curl -sL $url/healthcheck/version) | ||
response_sha=\"$(cut -d " " -f 4 <<< $response)\" | ||
|
||
bundle exec rspec spec/features/smoke_spec.rb --tag smoke_test | ||
current_commit_sha=\"$2\" | ||
if [[ -z $current_commit_sha ]]; then | ||
echo `date`" - smoke test failed (head sha is missing)" | ||
exit 1 | ||
fi | ||
|
||
if [[ $response_sha == $current_commit_sha ]]; then | ||
echo "✅ Correct version deployed" | ||
else | ||
echo "Fail: healthcheck sha is $response_sha but current commit is $current_commit_sha" | ||
exit 1 | ||
fi | ||
|
||
response=$(curl -sL $url/healthcheck/database) | ||
|
||
database_connected=$(cut -d " " -f 2 <<< $response) | ||
|
||
if [[ $database_connected == 'PASSED' ]]; then | ||
echo "✅ Database is connected" | ||
else | ||
echo "Fail: database is not connected" | ||
exit 1 | ||
fi |