Add progress reporting and make tests verbose

This commit is contained in:
Sergey Dudoladov 2019-05-03 10:39:19 +02:00
parent f2b73e0ae6
commit bfb6b5341d
2 changed files with 10 additions and 9 deletions

View File

@ -21,5 +21,5 @@ kubectl cluster-info
image=$(docker images --filter=reference="registry.opensource.zalan.do/acid/postgres-operator" --format "{{.Repository}}:{{.Tag}}" | head -1)
kind load docker-image ${image} --name ${cluster_name}
python3 -m unittest discover --start-directory e2e/tests/ &&
python3 -m unittest discover --start-directory e2e/tests/ -v &&
kind delete cluster --name ${cluster_name}

View File

@ -4,6 +4,7 @@ import timeout_decorator
import subprocess
import warnings
import docker
from halo import Halo
from kubernetes import client, config, utils
@ -113,11 +114,11 @@ class Utils:
@staticmethod
def wait_for_pod_start(k8s_api, pod_labels, retry_timeout_sec):
pod_phase = 'No pod running'
with Halo(text="Wait for the pod '{}' to start. Pod phase: {}".format(pod_labels, pod_phase), spinner='dots'):
while pod_phase != 'Running':
pods = k8s_api.core_v1.list_namespaced_pod('default', label_selector=pod_labels).items
if pods:
pod_phase = pods[0].status.phase
print("Wait for the pod '{}' to start. Current pod phase: {}".format(pod_labels, pod_phase))
time.sleep(retry_timeout_sec)
@staticmethod
@ -132,8 +133,8 @@ class Utils:
"v1", "default", "postgresqls", "acid-minimal-cluster", body)
labels = 'version=acid-minimal-cluster'
with Halo(text="Waiting for the cluster to scale to {} pods.".format(number_of_instances), spinner='dots'):
while Utils.count_pods_with_label(k8s_api, labels) != number_of_instances:
print("Waiting for the cluster to scale to {} pods.".format(number_of_instances))
time.sleep(retry_timeout_sec)
@staticmethod