Ian Fijolek
81211d1340
Some checks failed
continuous-integration/drone/push Build is failing
Still no logging or means of detecting failed attempts
48 lines
1.2 KiB
Bash
Executable File
48 lines
1.2 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
set -e
|
|
|
|
# Change to itest dir
|
|
cd "$(dirname "$0")"
|
|
|
|
function check_results() {
|
|
local f=$1
|
|
local min=$2
|
|
awk "/ok/ { count=count+1 } END { print \"$f: Run count\", count; if (count < $min) { print \"Expected > $min\"; exit 1 } }" "$f"
|
|
}
|
|
|
|
function main() {
|
|
# Clear and create result files
|
|
echo "start" > ./start_result.txt
|
|
echo "start" > ./exec_result.txt
|
|
|
|
# Clean old containers
|
|
docker compose down || true
|
|
# Start containers
|
|
echo "Starting containers"
|
|
docker compose up -d --build
|
|
# Schedules run on the shortest interval of a minute. This should allow time
|
|
# for the containers to start and execute once
|
|
local seconds=$((65 - $(date +"%S")))
|
|
echo "Containers started. Sleeping for ${seconds}s to let schedules run"
|
|
sleep $seconds
|
|
|
|
echo "Stopping containers"
|
|
docker compose stop
|
|
|
|
# Print logs
|
|
docker compose logs
|
|
|
|
# Validate result shows minimum amount of executions
|
|
check_results ./start_result.txt 2
|
|
check_results ./exec_result.txt 1
|
|
|
|
# Check for exec output
|
|
if ! (docker compose logs | grep -q "Yay!"); then
|
|
echo "Exec output 'Yay!' not found"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
main
|