You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/12/19 20:56:18 UTC
[airflow] branch main updated: Fix flaky test_recover_from_resource_too_old exception (#28475)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 0311ac9cb1 Fix flaky test_recover_from_resource_too_old exception (#28475)
0311ac9cb1 is described below
commit 0311ac9cb19a2c16131118c935d7973db89baaba
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Mon Dec 19 21:56:10 2022 +0100
Fix flaky test_recover_from_resource_too_old exception (#28475)
After #28047 the test_recover_from_resource_too_old started to
fail in a flaky way. Turned out that - depend on some other test
run the Singleton ResourceVersion could containt not one but
two namespaces (including default namespace).
Also while fixing the tests it's been noticed that the test
missed an assert - it did not assert that the Exception was in fact
thrown, so the test could have succeeded even if the exception was
not really thrown (there was assert in "except" clause but if the
exception was not thrown, it would not have been called at all).
---
tests/executors/test_kubernetes_executor.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/executors/test_kubernetes_executor.py b/tests/executors/test_kubernetes_executor.py
index 9f4fe76bac..e48d2087cb 100644
--- a/tests/executors/test_kubernetes_executor.py
+++ b/tests/executors/test_kubernetes_executor.py
@@ -1249,12 +1249,13 @@ class TestKubernetesJobWatcher:
try:
# self.watcher._run() is mocked and return "500" as last resource_version
self.watcher.run()
+ assert False, "Should have raised Exception"
except Exception as e:
assert e.args == ("sentinel",)
# both resource_version should be 0 after _run raises an exception
assert self.watcher.resource_version == "0"
- assert ResourceVersion().resource_version == {self.test_namespace: "0"}
+ assert ResourceVersion().resource_version[self.test_namespace] == "0"
# check that in the next run, _run is invoked with resource_version = 0
mock_underscore_run.reset_mock()