Fix annotation error case.
This commit is contained in:
parent
a53280e609
commit
89741c4d60
|
|
@ -101,7 +101,7 @@ class K8s:
|
||||||
for svc in svcs:
|
for svc in svcs:
|
||||||
for key, value in annotations.items():
|
for key, value in annotations.items():
|
||||||
if not svc.metadata.annotations or key not in svc.metadata.annotations or svc.metadata.annotations[key] != value:
|
if not svc.metadata.annotations or key not in svc.metadata.annotations or svc.metadata.annotations[key] != value:
|
||||||
print("Expected key {} not found in annotations {}".format(key, svc.metadata.annotation))
|
print("Expected key {} not found in annotations {}".format(key, svc.metadata.annotations))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -614,7 +614,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
"spec": {
|
"spec": {
|
||||||
"serviceAnnotations": {
|
"serviceAnnotations": {
|
||||||
"annotation.key": "value",
|
"annotation.key": "value",
|
||||||
"foo": "bar",
|
"alice": "bob",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,6 +624,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
annotations = {
|
annotations = {
|
||||||
"annotation.key": "value",
|
"annotation.key": "value",
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
|
"alice": "bob"
|
||||||
}
|
}
|
||||||
|
|
||||||
self.eventuallyTrue(lambda: k8s.check_service_annotations("cluster-name=acid-minimal-cluster,spilo-role=master", annotations), "Wrong annotations")
|
self.eventuallyTrue(lambda: k8s.check_service_annotations("cluster-name=acid-minimal-cluster,spilo-role=master", annotations), "Wrong annotations")
|
||||||
|
|
@ -721,7 +722,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@timeout_decorator.timeout(TEST_TIMEOUT_SEC)
|
@timeout_decorator.timeout(TEST_TIMEOUT_SEC)
|
||||||
def test_x_cluster_deletion(self):
|
def test_zzzz_cluster_deletion(self):
|
||||||
'''
|
'''
|
||||||
Test deletion with configured protection
|
Test deletion with configured protection
|
||||||
'''
|
'''
|
||||||
|
|
@ -774,17 +775,14 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
k8s.api.custom_objects_api.delete_namespaced_custom_object(
|
k8s.api.custom_objects_api.delete_namespaced_custom_object(
|
||||||
"acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster")
|
"acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster")
|
||||||
|
|
||||||
# wait until cluster is deleted
|
|
||||||
time.sleep(120)
|
|
||||||
|
|
||||||
# check if everything has been deleted
|
# check if everything has been deleted
|
||||||
self.assertEqual(0, k8s.count_pods_with_label(cluster_label))
|
self.eventuallyEqual(lambda: k8s.count_pods_with_label(cluster_label), 0, "Pods not deleted")
|
||||||
self.assertEqual(0, k8s.count_services_with_label(cluster_label))
|
self.eventuallyEqual(lambda: k8s.count_services_with_label(cluster_label), 0, "Service not deleted")
|
||||||
self.assertEqual(0, k8s.count_endpoints_with_label(cluster_label))
|
self.eventuallyEqual(lambda: k8s.count_endpoints_with_label(cluster_label), 0, "Endpoints not deleted")
|
||||||
self.assertEqual(0, k8s.count_statefulsets_with_label(cluster_label))
|
self.eventuallyEqual(lambda: k8s.count_statefulsets_with_label(cluster_label), 0, "Statefulset not deleted")
|
||||||
self.assertEqual(0, k8s.count_deployments_with_label(cluster_label))
|
self.eventuallyEqual(lambda: k8s.count_deployments_with_label(cluster_label), 0, "Deployments not deleted")
|
||||||
self.assertEqual(0, k8s.count_pdbs_with_label(cluster_label))
|
self.eventuallyEqual(lambda: k8s.count_pdbs_with_label(cluster_label), 0, "Pod disruption budget not deleted")
|
||||||
self.assertEqual(0, k8s.count_secrets_with_label(cluster_label))
|
self.eventuallyEqual(lambda: k8s.count_secrets_with_label(cluster_label), 0, "Secrets not deleted")
|
||||||
|
|
||||||
except timeout_decorator.TimeoutError:
|
except timeout_decorator.TimeoutError:
|
||||||
print('Operator log: {}'.format(k8s.get_operator_log()))
|
print('Operator log: {}'.format(k8s.get_operator_log()))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue