Skip to content
Snippets Groups Projects
Verified Commit 4a7e796a authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

Test if all expected replicas are ready for deployments and statefulsets,...

Test if all expected replicas are ready for deployments and statefulsets, improve test for daemonsets

TRIGGER_JOBS=enable-nextcloud,enable-monitoring,enable-wekan,enable-wordpress,enable-rocketchat
parent 0a0ede40
No related branches found
No related tags found
No related merge requests found
......@@ -227,10 +227,18 @@ def test_deployments(resource, namespace):
resource = deployment.metadata.name
namespace = deployment.metadata.namespace
deployment = api.read_namespaced_deployment_status(resource, namespace)
ready = deployment.status.replicas == deployment.status.ready_replicas
print(f'Deployment "{resource}" in namespace "{namespace}": {ready}')
if not ready:
for condition in deployment.status.conditions:
if condition.type == 'Available':
available = condition.status == 'True'
replicas = deployment.spec.replicas
ready_replicas = deployment.status.ready_replicas
# Check if all replicas from the spec are ready
print(f'Deployment "{resource}" in namespace "{namespace}": '
f'{available} ({ready_replicas}/{replicas})')
if not available or replicas != ready_replicas:
failed += 1
failed_resources.append(resource)
......@@ -267,10 +275,12 @@ def test_statefulsets(resource, namespace):
for statefulset in statefulsets.items:
resource = statefulset.metadata.name
namespace = statefulset.metadata.namespace
status = api.read_namespaced_stateful_set_status(resource, namespace)
ready = status.status.replicas == status.status.ready_replicas
print(f'statefulset "{resource}" in namespace "{namespace}": {ready}')
if not ready:
statefulset = api.read_namespaced_stateful_set_status(resource, namespace)
replicas = statefulset.spec.replicas
ready_replicas = statefulset.status.ready_replicas
print(f'statefulset "{resource}" in namespace "{namespace}": '
f'{ready_replicas}/{replicas}')
if replicas != ready_replicas:
failed += 1
failed_resources.append(resource)
......@@ -307,10 +317,12 @@ def test_daemonsets(resource, namespace):
for daemonset in daemonsets.items:
resource = daemonset.metadata.name
namespace = daemonset.metadata.namespace
status = api.read_namespaced_daemon_set_status(resource, namespace)
ready = status.status.desired_number_scheduled == status.status.number_available
print(f'daemonset "{resource}" in namespace "{namespace}": {ready}')
if not ready:
daemonset = api.read_namespaced_daemon_set_status(resource, namespace)
desired_number_scheduled = daemonset.status.desired_number_scheduled
number_ready = daemonset.status.number_ready
print(f'daemonset "{resource}" in namespace "{namespace}": '
f'{number_ready}/{desired_number_scheduled}')
if desired_number_scheduled != number_ready:
failed += 1
failed_resources.append(resource)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment