Skip to content

Commit

Permalink
ci: wait for try-runtime logs (#960)
Browse files Browse the repository at this point in the history
* test try-runtime 01

* test try-runtime 02

* test try-runtime 03

* test try-runtime 04

* test try-runtime 05

* test try-runtime

* test try-runtime 6

* test 7

* test try-runtime 8

* test try-runtime 9

* test try-runtime 10
  • Loading branch information
BuddyGlas authored Jul 11, 2023
1 parent 28d97ca commit 724706b
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
try-runtime-tests:
needs: [prepare-execution-marix, try-runtime-build]
# The type of runner that the job will run on
runs-on: [self-hosted-ci]
runs-on: [medium]

timeout-minutes: 600

Expand Down Expand Up @@ -186,13 +186,70 @@ jobs:
- name: Build the stack
run: docker-compose -f ".docker/docker-compose.try-runtime.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300

- name: Check if docker logs consist logs related to Runtime Upgrade testing.
if: success()
run: |
counter=300
counter_life=0
function check_container_status {
docker inspect -f {{.State.Running}} try-runtime
}
function do_docker_logs {
docker logs --details try-runtime 2>&1 | grep -i 'TryRuntime_on_runtime_upgrade executed without errors. Consumed'
}
function is_started {
if [ "$(check_container_status)" == "true" ]; then
echo "Container: try-runtime RUNNING";
echo "Check Docker logs"
DOCKER_LOGS=$(do_docker_logs)
if [[ -n ${DOCKER_LOGS} ]]; then
echo "TryRuntime_on_runtime_upgrade executed without errors."
return 0
else
echo "Message not found in logs output, repeating..."
return 1
fi
else
DOCKER_LOGS=$(do_docker_logs)
while [ $counter_life -lt 3 ]
do
(( counter_life++ ))
if [[ -n ${DOCKER_LOGS} ]]; then
echo "TryRuntime_on_runtime_upgrade executed without errors"
return 0
else
echo "Container try-runtime not RUNNING"
return 1
fi
done
fi
exit 0
}
while ! is_started; do
echo "Waiting for special message in log files "
sleep 30s
counter=$(( $counter - 1 ))
echo "Counter: $counter"
if [ "$counter" -gt "0" ]; then
continue
else
echo "Counter reached zero, yet upgrade is not finished"
exit 1
fi
done
echo "Halting script"
exit 0
shell: bash

- name: Collect Docker Logs
if: success() || failure()
uses: jwalton/[email protected]
with:
dest: './try-runtime-logs.${{ matrix.network }}'

- name: Show docker logs
if: success() || failure()
run: cat './try-runtime-logs.${{ matrix.network }}/try-runtime.log'

- name: Stop running containers
Expand Down

0 comments on commit 724706b

Please sign in to comment.