Verify explicit sync of deployment.
This commit is contained in:
parent
89741c4d60
commit
88e89956e0
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
kubectl delete postgresql acid-minimal-cluster
|
||||||
|
kubectl delete deployments -l application=db-connection-pooler,cluster-name=acid-minimal-cluster
|
||||||
|
kubectl delete statefulsets -l application=spilo,cluster-name=acid-minimal-cluster
|
||||||
|
kubectl delete services -l application=spilo,cluster-name=acid-minimal-cluster
|
||||||
|
kubectl delete configmap postgres-operator
|
||||||
|
kubectl delete deployment postgres-operator
|
||||||
|
|
@ -9,6 +9,7 @@ import yaml
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from kubernetes import client, config
|
from kubernetes import client, config
|
||||||
|
from kubernetes.client.rest import ApiException
|
||||||
|
|
||||||
class K8sApi:
|
class K8sApi:
|
||||||
|
|
||||||
|
|
@ -222,6 +223,13 @@ class K8s:
|
||||||
def get_patroni_running_members(self, pod="acid-minimal-cluster-0"):
|
def get_patroni_running_members(self, pod="acid-minimal-cluster-0"):
|
||||||
result = self.get_patroni_state(pod)
|
result = self.get_patroni_state(pod)
|
||||||
return list(filter(lambda x: "State" in x and x["State"] == "running", result))
|
return list(filter(lambda x: "State" in x and x["State"] == "running", result))
|
||||||
|
|
||||||
|
def get_deployment_replica_count(self, name="acid-minimal-cluster-pooler", namespace="default"):
|
||||||
|
try:
|
||||||
|
deployment = self.api.apps_v1.read_namespaced_deployment(name, namespace)
|
||||||
|
return deployment.spec.replicas
|
||||||
|
except ApiException as e:
|
||||||
|
return None
|
||||||
|
|
||||||
def get_statefulset_image(self, label_selector="application=spilo,cluster-name=acid-minimal-cluster", namespace='default'):
|
def get_statefulset_image(self, label_selector="application=spilo,cluster-name=acid-minimal-cluster", namespace='default'):
|
||||||
ssets = self.api.apps_v1.list_namespaced_stateful_set(namespace, label_selector=label_selector, limit=1)
|
ssets = self.api.apps_v1.list_namespaced_stateful_set(namespace, label_selector=label_selector, limit=1)
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.eventuallyEqual(lambda: k8s.get_deployment_replica_count(), 2, "Deployment replicas is 2 default")
|
||||||
self.eventuallyEqual(lambda: k8s.count_running_pods("connection-pooler=acid-minimal-cluster-pooler"), 2, "No pooler pods found")
|
self.eventuallyEqual(lambda: k8s.count_running_pods("connection-pooler=acid-minimal-cluster-pooler"), 2, "No pooler pods found")
|
||||||
self.eventuallyEqual(lambda: k8s.count_services_with_label('application=db-connection-pooler,cluster-name=acid-minimal-cluster'), 1, "No pooler service found")
|
self.eventuallyEqual(lambda: k8s.count_services_with_label('application=db-connection-pooler,cluster-name=acid-minimal-cluster'), 1, "No pooler service found")
|
||||||
|
|
||||||
|
|
@ -177,6 +178,7 @@ class EndToEndTestCase(unittest.TestCase):
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.eventuallyEqual(lambda: k8s.get_deployment_replica_count(), 3, "Deployment replicas is scaled to 3")
|
||||||
self.eventuallyEqual(lambda: k8s.count_running_pods("connection-pooler=acid-minimal-cluster-pooler"), 3, "Scale up of pooler pods does not work")
|
self.eventuallyEqual(lambda: k8s.count_running_pods("connection-pooler=acid-minimal-cluster-pooler"), 3, "Scale up of pooler pods does not work")
|
||||||
|
|
||||||
# turn it off, keeping config should be overwritten by false
|
# turn it off, keeping config should be overwritten by false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue