Skip to content

Commit fe78062

Browse files
szachovyCopilot
andcommitted
Add cluster readiness verification between test plays
Insert a verification play between system and functional tests that checks all containers are healthy on all 5 nodes before proceeding. Failures now show 'cluster not ready' instead of obscure API errors. Closes #56 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit fe78062

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
* Dependabot updates for `github-actions` and `terraform` ecosystems. (#29)
1616
* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97)
1717
* Pull-first with local build fallback for container images during deployment. (#97)
18+
* Cluster readiness verification play between system and functional tests. (#56)
1819

1920
### Changed
2021

tests/testsuite/deploy.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,42 @@
1515
- name: "Run system tasks from testing role"
1616
ansible.builtin.include_role: {name: "testing", tasks_from: "system"}
1717

18+
- name: "Cluster readiness verification"
19+
connection: "local"
20+
hosts: "testing"
21+
any_errors_fatal: true
22+
tasks:
23+
- name: "Verify all containers are healthy on each node"
24+
community.docker.docker_container_exec:
25+
container: "{{ item }}"
26+
command: |
27+
{% raw %}
28+
/bin/bash -c
29+
'UNHEALTHY=$(docker ps -a --filter "health=unhealthy" --format "{{.Names}}");
30+
if [ -n "$UNHEALTHY" ]; then
31+
echo "Unhealthy containers: $UNHEALTHY"; exit 1;
32+
fi;
33+
RUNNING=$(docker ps --format "{{.Names}}" | wc -l);
34+
if [ "$RUNNING" -eq 0 ]; then
35+
echo "No running containers"; exit 1;
36+
fi;
37+
echo "All $RUNNING containers healthy"'
38+
{% endraw %}
39+
loop:
40+
- "{{ node_prefix }}-0"
41+
- "{{ node_prefix }}-1"
42+
- "{{ node_prefix }}-2"
43+
- "{{ node_prefix }}-3"
44+
- "{{ node_prefix }}-4"
45+
register: "readiness_check"
46+
47+
- name: "Cluster readiness results"
48+
ansible.builtin.debug:
49+
msg: "{{ item.stdout }}"
50+
loop: "{{ readiness_check.results }}"
51+
loop_control:
52+
label: "{{ item.item }}"
53+
1854
- name: "Functional testing"
1955
connection: "local"
2056
hosts: "testing"

0 commit comments

Comments
 (0)