Add progress reporting and make tests verbose
This commit is contained in:
		
							parent
							
								
									f2b73e0ae6
								
							
						
					
					
						commit
						bfb6b5341d
					
				|  | @ -21,5 +21,5 @@ kubectl cluster-info | ||||||
| image=$(docker images --filter=reference="registry.opensource.zalan.do/acid/postgres-operator" --format "{{.Repository}}:{{.Tag}}"  | head -1) | 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} | 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} | kind delete cluster --name ${cluster_name} | ||||||
|  | @ -4,6 +4,7 @@ import timeout_decorator | ||||||
| import subprocess | import subprocess | ||||||
| import warnings | import warnings | ||||||
| import docker | import docker | ||||||
|  | from halo import Halo | ||||||
| 
 | 
 | ||||||
| from kubernetes import client, config, utils | from kubernetes import client, config, utils | ||||||
| 
 | 
 | ||||||
|  | @ -113,11 +114,11 @@ class Utils: | ||||||
|     @staticmethod |     @staticmethod | ||||||
|     def wait_for_pod_start(k8s_api, pod_labels, retry_timeout_sec): |     def wait_for_pod_start(k8s_api, pod_labels, retry_timeout_sec): | ||||||
|         pod_phase = 'No pod running' |         pod_phase = 'No pod running' | ||||||
|         while pod_phase != 'Running': |         with Halo(text="Wait for the pod '{}' to start. Pod phase: {}".format(pod_labels, pod_phase), spinner='dots'): | ||||||
|             pods = k8s_api.core_v1.list_namespaced_pod('default', label_selector=pod_labels).items |             while pod_phase != 'Running': | ||||||
|             if pods: |                 pods = k8s_api.core_v1.list_namespaced_pod('default', label_selector=pod_labels).items | ||||||
|                 pod_phase = pods[0].status.phase |                 if pods: | ||||||
|             print("Wait for the pod '{}' to start. Current pod phase: {}".format(pod_labels, pod_phase)) |                     pod_phase = pods[0].status.phase | ||||||
|             time.sleep(retry_timeout_sec) |             time.sleep(retry_timeout_sec) | ||||||
| 
 | 
 | ||||||
|     @staticmethod |     @staticmethod | ||||||
|  | @ -132,9 +133,9 @@ class Utils: | ||||||
|                                                        "v1", "default", "postgresqls", "acid-minimal-cluster", body) |                                                        "v1", "default", "postgresqls", "acid-minimal-cluster", body) | ||||||
| 
 | 
 | ||||||
|         labels = 'version=acid-minimal-cluster' |         labels = 'version=acid-minimal-cluster' | ||||||
|         while Utils.count_pods_with_label(k8s_api, labels) != number_of_instances: |         with Halo(text="Waiting for the cluster to scale to {} pods.".format(number_of_instances), spinner='dots'): | ||||||
|             print("Waiting for the cluster to scale to {} pods.".format(number_of_instances)) |             while Utils.count_pods_with_label(k8s_api, labels) != number_of_instances: | ||||||
|             time.sleep(retry_timeout_sec) |                 time.sleep(retry_timeout_sec) | ||||||
| 
 | 
 | ||||||
|     @staticmethod |     @staticmethod | ||||||
|     def count_pods_with_label(k8s_api, labels): |     def count_pods_with_label(k8s_api, labels): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue