From: Stefan Eissing Date: Wed, 25 Aug 2021 14:31:12 +0000 (+0000) Subject: * test/modules/http2: using stop/start instead of reload when changing apache configs X-Git-Tag: 2.5.0-alpha2-ci-test-only~854 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=376e04c95aed826ddedf8351adf6950e3a42b40a;p=thirdparty%2Fapache%2Fhttpd.git * test/modules/http2: using stop/start instead of reload when changing apache configs 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 --- diff --git a/test/modules/http2/h2_env.py b/test/modules/http2/h2_env.py index 0e59774b191..03dd271d031 100644 --- a/test/modules/http2/h2_env.py +++ b/test/modules/http2/h2_env.py @@ -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): diff --git a/test/modules/http2/test_106_shutdown.py b/test/modules/http2/test_106_shutdown.py index 218c75669df..37471d26cab 100644 --- a/test/modules/http2/test_106_shutdown.py +++ b/test/modules/http2/test_106_shutdown.py @@ -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