avoid dropping DELETE event for cron job

This commit is contained in:
Sergey Dudoladov 2019-05-23 12:19:21 +02:00
parent da2e251b5c
commit 0ec3739732
2 changed files with 7 additions and 5 deletions

View File

@ -323,6 +323,8 @@ The tests utilize examples from `/manifests` (ConfigMap is used for the operator
End-to-end tests are executed automatically during builds; to invoke them locally use `make e2e-run` from the project's top directory. Run `make e2e-tools e2e-build` to install `kind` and build the tests' image locally before the first run. End-to-end tests are executed automatically during builds; to invoke them locally use `make e2e-run` from the project's top directory. Run `make e2e-tools e2e-build` to install `kind` and build the tests' image locally before the first run.
End-to-end tests are written in Python and use `flake8` for code quality. Please run flake8 [before submitting a PR](http://flake8.pycqa.org/en/latest/user/using-hooks.html).
## Introduce additional configuration parameters ## Introduce additional configuration parameters
In the case you want to add functionality to the operator that shall be In the case you want to add functionality to the operator that shall be

View File

@ -65,7 +65,7 @@ class SmokeTestCase(unittest.TestCase):
Utils.wait_for_pod_start(k8s_api, 'spilo-role=master', cls.RETRY_TIMEOUT_SEC) Utils.wait_for_pod_start(k8s_api, 'spilo-role=master', cls.RETRY_TIMEOUT_SEC)
@timeout_decorator.timeout(TEST_TIMEOUT_SEC) @timeout_decorator.timeout(TEST_TIMEOUT_SEC)
def master_is_unique(self): def test_master_is_unique(self):
""" """
Check that there is a single pod in the k8s cluster with the label "spilo-role=master". Check that there is a single pod in the k8s cluster with the label "spilo-role=master".
""" """
@ -76,7 +76,7 @@ class SmokeTestCase(unittest.TestCase):
self.assertEqual(num_of_master_pods, 1, "Expected 1 master pod, found {}".format(num_of_master_pods)) self.assertEqual(num_of_master_pods, 1, "Expected 1 master pod, found {}".format(num_of_master_pods))
@timeout_decorator.timeout(TEST_TIMEOUT_SEC) @timeout_decorator.timeout(TEST_TIMEOUT_SEC)
def scaling(self): def test_scaling(self):
""" """
Scale up from 2 to 3 pods and back to 2 by updating the Postgres manifest at runtime. Scale up from 2 to 3 pods and back to 2 by updating the Postgres manifest at runtime.
""" """
@ -91,7 +91,7 @@ class SmokeTestCase(unittest.TestCase):
self.assertEqual(2, Utils.count_pods_with_label(k8s, labels)) self.assertEqual(2, Utils.count_pods_with_label(k8s, labels))
@timeout_decorator.timeout(TEST_TIMEOUT_SEC) @timeout_decorator.timeout(TEST_TIMEOUT_SEC)
def taint_based_eviction(self): def test_taint_based_eviction(self):
""" """
Add taint "postgres=:NoExecute" to node with master. Add taint "postgres=:NoExecute" to node with master.
""" """
@ -175,8 +175,8 @@ class SmokeTestCase(unittest.TestCase):
operator_pod = k8s.core_v1.list_namespaced_pod('default', label_selector="name=postgres-operator").items[0].metadata.name operator_pod = k8s.core_v1.list_namespaced_pod('default', label_selector="name=postgres-operator").items[0].metadata.name
k8s.core_v1.delete_namespaced_pod(operator_pod, "default") # restart reloads the conf k8s.core_v1.delete_namespaced_pod(operator_pod, "default") # restart reloads the conf
Utils.wait_for_pod_start(k8s, 'name=postgres-operator', self.RETRY_TIMEOUT_SEC) Utils.wait_for_pod_start(k8s, 'name=postgres-operator', self.RETRY_TIMEOUT_SEC)
#TODO replace this timeout with a meaningful condition to avodi dropping a delete event #HACK avoid dropping a delete event when the operator pod has the label but is still starting
time.sleep(30) time.sleep(10)
# delete the logical backup cron job # delete the logical backup cron job
pg_patch_disable_backup = { pg_patch_disable_backup = {