-
Notifications
You must be signed in to change notification settings - Fork 1
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
46 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,27 @@ jobs: | |
steps: | ||
# need checkout before using docker-compose-action | ||
- uses: actions/checkout@v3 | ||
- uses: adambirds/docker-compose-action@v1.3.0 | ||
- uses: isbang/compose-action@v1.5.1 | ||
with: | ||
compose-file: "docker-compose.yml" | ||
down-flags: "--volumes --remove-orphans --rmi local" | ||
test-container: "blood-info" | ||
test-command: "$(wget -q -O- --no-check-certificate https://localhost:8443/station | jq '. | length') -gt 0" | ||
services: | | ||
db | ||
blood-info | ||
scraper | ||
- name: Run Tests | ||
shell: bash | ||
run: sleep 10 && docker-compose run --rm test | ||
|
||
- uses: isbang/[email protected] | ||
with: | ||
compose-file: "docker-compose.yml" | ||
down-flags: "--volumes --remove-orphans --rmi local" | ||
services: | | ||
test | ||
- name: Stop | ||
if: always() | ||
shell: bash | ||
run: docker-compose down |
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,20 @@ | ||
#!/bin/sh | ||
|
||
# Define variables | ||
total_duration=30 # Total duration in seconds | ||
interval=5 # Interval in seconds | ||
end_time=$(($(date +%s) + total_duration)) | ||
|
||
# Run the test in a loop | ||
while [ $(date +%s) -lt $end_time ]; do | ||
result=$(wget -q -O- --no-check-certificate https://blood-info:8443/stations | jq '. | length') | ||
if [ -n "$result" ] && [ "$result" -ne 0 ]; then | ||
echo "Test passed: There are $result stations reported." | ||
exit 0 | ||
fi | ||
|
||
sleep $interval # Wait for the specified interval before the next test | ||
done | ||
|
||
echo "Test failed: Result is empty or zero." | ||
exit 1 # Test failed |