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 2020/10/18 09:53:00 UTC

[airflow] branch master updated: Teardown of webserver tests is not picky about processes. (#11616)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new db3fe09  Teardown of webserver tests is not picky about processes. (#11616)
db3fe09 is described below

commit db3fe0926bb75008311eed804052c90bfa912424
Author: Jarek Potiuk <ja...@polidea.com>
AuthorDate: Sun Oct 18 11:52:23 2020 +0200

    Teardown of webserver tests is not picky about processes. (#11616)
    
    Fixes random failure when processes are still running
    on teardown of some webserver tests. We simply ignor that
    after we send sigkill to those processes.
    
    Fixes #11615
---
 tests/cli/commands/test_webserver_command.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/cli/commands/test_webserver_command.py b/tests/cli/commands/test_webserver_command.py
index 479a141..ad4fd12 100644
--- a/tests/cli/commands/test_webserver_command.py
+++ b/tests/cli/commands/test_webserver_command.py
@@ -227,7 +227,7 @@ class TestCliWebServer(unittest.TestCase):
         self._check_processes()
         self._clean_pidfiles()
 
-    def _check_processes(self):
+    def _check_processes(self, ignore_running=False):
         # Confirm that webserver hasn't been launched.
         # pgrep returns exit status 1 if no process matched.
         exit_code_pgrep_webserver = subprocess.Popen(["pgrep", "-c", "-f", "airflow webserver"]).wait()
@@ -238,13 +238,13 @@ class TestCliWebServer(unittest.TestCase):
                 subprocess.Popen(["pkill", "-9", "-f", "airflow webserver"]).wait()
             if exit_code_pgrep_gunicorn != 1:
                 subprocess.Popen(["pkill", "-9", "-f", "gunicorn"]).wait()
-
-            raise AssertionError(
-                "Background processes are running that prevent the test from passing successfully."
-            )
+            if not ignore_running:
+                raise AssertionError(
+                    "Background processes are running that prevent the test from passing successfully."
+                )
 
     def tearDown(self) -> None:
-        self._check_processes()
+        self._check_processes(ignore_running=True)
         self._clean_pidfiles()
 
     def _clean_pidfiles(self):