]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* test/modules/http2: using stop/start instead of reload when changing apache configs
authorStefan Eissing <icing@apache.org>
Wed, 25 Aug 2021 14:31:12 +0000 (14:31 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 25 Aug 2021 14:31:12 +0000 (14:31 +0000)
   to give reliable results. The new reload behaviour keeps old children around until
   very late and may answer on old configurations.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892598 13f79535-47bb-0310-9956-ffa450edef68

test/modules/http2/h2_env.py
test/modules/http2/test_106_shutdown.py

index 0e59774b1919615e10bbf9e7b307c919cf08374e..03dd271d031daa5cb0054e7db9450e03f52421df 100644 (file)
@@ -404,7 +404,7 @@ class H2TestEnv:
         log.debug("Server still responding after %d sec", timeout)
         return False
 
-    def apachectl(self, cmd, check_live=True):
+    def _run_apachectl(self, cmd):
         args = [self._apachectl,
                 "-d", self.server_dir,
                 "-f", os.path.join(self._server_dir, 'conf/httpd.conf'),
@@ -412,25 +412,32 @@ class H2TestEnv:
         log.debug("execute: %s", " ".join(args))
         p = subprocess.run(args, capture_output=True, text=True)
         rv = p.returncode
+        if rv != 0:
+            log.warning(f"exit {rv}, stdout: {p.stdout}, stderr: {p.stderr}")
+        return rv
+
+    def apache_reload(self):
+        rv = self._run_apachectl("graceful")
         if rv == 0:
             timeout = timedelta(seconds=10)
-            if check_live:
-                rv = 0 if self.is_live(self._http_base, timeout=timeout) else -1
-            else:
-                rv = 0 if self.is_dead(self._http_base, timeout=timeout) else -1
-                log.debug("waited for a apache.is_dead, rv=%d", rv)
-        else:
-            log.warning(f"exit {rv}, stdout: {p.stdout}, stderr: {p.stderr}")
+            rv = 0 if self.is_live(self._http_base, timeout=timeout) else -1
         return rv
 
     def apache_restart(self):
-        return self.apachectl("graceful")
+        rv = self.apache_stop()
+        rv = self._run_apachectl("start")
+        if rv == 0:
+            timeout = timedelta(seconds=10)
+            rv = 0 if self.is_live(self._http_base, timeout=timeout) else -1
+        return rv
         
-    def apache_start(self):
-        return self.apachectl("start")
-
     def apache_stop(self):
-        return self.apachectl("stop", check_live=False)
+        rv = self._run_apachectl("stop")
+        if rv == 0:
+            timeout = timedelta(seconds=10)
+            rv = 0 if self.is_dead(self._http_base, timeout=timeout) else -1
+            log.debug("waited for a apache.is_dead, rv=%d", rv)
+        return rv
 
     def apache_error_log_clear(self):
         if os.path.isfile(self._server_error_log):
index 218c75669df14048649169393784872465098849..37471d26cabc354b2ce8e062f43842d85dc9a707 100644 (file)
@@ -37,7 +37,7 @@ class TestShutdown:
         t = Thread(target=long_request)
         t.start()
         time.sleep(0.5)
-        assert env.apache_restart() == 0
+        assert env.apache_reload() == 0
         t.join()
         # noinspection PyTypeChecker
         r: ExecResult = self.r