airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] mik-laj commented on a change in pull request #6579: [AIRFLOW-5926] Fix race-condition in TestCliWebServer
Date Wed, 13 Nov 2019 19:32:57 GMT
mik-laj commented on a change in pull request #6579: [AIRFLOW-5926] Fix race-condition in TestCliWebServer
URL: https://github.com/apache/airflow/pull/6579#discussion_r345959254
 
 

 ##########
 File path: tests/cli/test_cli.py
 ##########
 @@ -801,30 +817,24 @@ def test_cli_webserver_foreground_with_pid(self):
     @unittest.skipIf("TRAVIS" in os.environ and bool(os.environ["TRAVIS"]),
                      "Skipping test due to lack of required file permission")
     def test_cli_webserver_background(self):
-        # Confirm that webserver hasn't been launched.
-        self.assertEqual(1, subprocess.Popen(["pgrep", "-c", "airflow"]).wait())
-        self.assertEqual(1, subprocess.Popen(["pgrep", "-c", "gunicorn"]).wait())
+        pidfile_webserver = cli.setup_locations("webserver")[0]
+        pidfile_monitor = cli.setup_locations("webserver-monitor")[0]
 
-        # Run webserver in background.
+        # Run webserver as deamon in background. Note that the wait method is not called.
         subprocess.Popen(["airflow", "webserver", "-D"])
-        pidfile = cli.setup_locations("webserver")[0]
-        self._wait_pidfile(pidfile)
+
+        pid_monitor = self._wait_pidfile(pidfile_monitor)
+        self._wait_pidfile(pidfile_webserver)
 
         # Assert that gunicorn and its monitor are launched.
-        self.assertEqual(0, subprocess.Popen(["pgrep", "-c", "airflow"]).wait())
+        self.assertEqual(0, subprocess.Popen(["pgrep", "-f", "-c", "airflow webserver"]).wait())
 
 Review comment:
   Daemon is not found without the -f option. Sometimes pgrep would find the user process
(824 linie) and report success, but if it didn't, the test would fail.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message