better key lookup of annotations tests
This commit is contained in:
parent
ab8e8dc06a
commit
d9f9b17338
|
|
@ -428,7 +428,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
k8s.api.core_v1.patch_node(current_master_node, patch_readiness_label)
|
k8s.api.core_v1.patch_node(current_master_node, patch_readiness_label)
|
||||||
|
|
||||||
# wait a little before proceeding with the pod distribution test
|
# wait a little before proceeding with the pod distribution test
|
||||||
time.sleep(k8s.RETRY_TIMEOUT_SEC)
|
time.sleep(30)
|
||||||
|
|
||||||
# toggle pod anti affinity to move replica away from master node
|
# toggle pod anti affinity to move replica away from master node
|
||||||
self.assert_distributed_pods(new_master_node, new_replica_nodes, cluster_label)
|
self.assert_distributed_pods(new_master_node, new_replica_nodes, cluster_label)
|
||||||
|
|
@ -472,6 +472,8 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
k8s.api.custom_objects_api.patch_namespaced_custom_object(
|
k8s.api.custom_objects_api.patch_namespaced_custom_object(
|
||||||
"acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster", pg_patch_custom_annotations)
|
"acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster", pg_patch_custom_annotations)
|
||||||
|
|
||||||
|
# wait a little before proceeding
|
||||||
|
time.sleep(30)
|
||||||
annotations = {
|
annotations = {
|
||||||
"annotation.key": "value",
|
"annotation.key": "value",
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
|
|
@ -562,7 +564,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
k8s.update_config(patch_toleration_config)
|
k8s.update_config(patch_toleration_config)
|
||||||
|
|
||||||
# wait a little before proceeding with the pod distribution test
|
# wait a little before proceeding with the pod distribution test
|
||||||
time.sleep(k8s.RETRY_TIMEOUT_SEC)
|
time.sleep(30)
|
||||||
|
|
||||||
# toggle pod anti affinity to move replica away from master node
|
# toggle pod anti affinity to move replica away from master node
|
||||||
self.assert_distributed_pods(new_master_node, new_replica_nodes, cluster_label)
|
self.assert_distributed_pods(new_master_node, new_replica_nodes, cluster_label)
|
||||||
|
|
@ -728,20 +730,16 @@ class K8s:
|
||||||
def check_service_annotations(self, svc_labels, annotations, namespace='default'):
|
def check_service_annotations(self, svc_labels, annotations, namespace='default'):
|
||||||
svcs = self.api.core_v1.list_namespaced_service(namespace, label_selector=svc_labels, limit=1).items
|
svcs = self.api.core_v1.list_namespaced_service(namespace, label_selector=svc_labels, limit=1).items
|
||||||
for svc in svcs:
|
for svc in svcs:
|
||||||
if len(svc.metadata.annotations) < len(annotations):
|
for key, value in annotations:
|
||||||
return False
|
if key not in svc.metadata.annotations or svc.metadata.annotations[key] != value:
|
||||||
for key in svc.metadata.annotations:
|
|
||||||
if svc.metadata.annotations[key] != annotations[key]:
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check_statefulset_annotations(self, sset_labels, annotations, namespace='default'):
|
def check_statefulset_annotations(self, sset_labels, annotations, namespace='default'):
|
||||||
ssets = self.api.apps_v1.list_namespaced_stateful_set(namespace, label_selector=sset_labels, limit=1).items
|
ssets = self.api.apps_v1.list_namespaced_stateful_set(namespace, label_selector=sset_labels, limit=1).items
|
||||||
for sset in ssets:
|
for sset in ssets:
|
||||||
if len(sset.metadata.annotations) < len(annotations):
|
for key, value in annotations:
|
||||||
return False
|
if key not in sset.metadata.annotations or sset.metadata.annotations[key] != value:
|
||||||
for key in sset.metadata.annotations:
|
|
||||||
if sset.metadata.annotations[key] != annotations[key]:
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue