Skip to content

Commit

Permalink
* test/load_test.py move outside of module test suite, fixed use
Browse files Browse the repository at this point in the history
   of updated pyhttpd test framework.
  • Loading branch information
npuichigoB committed May 15, 2026
1 parent b60f2dd commit 072839d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test:
pytest

loadtest:
python3 modules/http2/load_test.py
python3 load_test.py

clean-local:
rm -rf *.pyc __pycache__
Expand Down
15 changes: 9 additions & 6 deletions test/modules/http2/load_test.py → test/load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

from tqdm import tqdm

sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(os.path.join(os.path.dirname(__file__), ''))

from .env import H2TestEnv, H2Conf
from modules.http2.env import H2TestEnv, H2Conf, H2TestSetup
from pyhttpd.result import ExecResult

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -215,8 +215,8 @@ def shutdown(self):
raise NotImplemented

@staticmethod
def setup_base_conf(env: H2TestEnv, worker_count: int = 5000) -> H2Conf:
conf = H2Conf(env=env)
def setup_base_conf(env: H2TestEnv, worker_count: int = 5000, extras=None) -> H2Conf:
conf = H2Conf(env=env, extras=extras)
# ylavic's formula
process_count = int(max(10, min(100, int(worker_count / 100))))
thread_count = int(max(25, int(worker_count / process_count)))
Expand Down Expand Up @@ -246,7 +246,6 @@ def start_server(env: H2TestEnv, cd: timedelta = None):

@staticmethod
def server_setup(env: H2TestEnv, extras: Dict = None):
conf = LoadTestCase.setup_base_conf(env=env)
if not extras:
extras = {
'base': """
Expand All @@ -272,7 +271,8 @@ def server_setup(env: H2TestEnv, extras: Dict = None):
ProxyPass /proxy-h1/ https://127.0.0.1:{env.https_port}/
ProxyPass /proxy-h2/ h2://127.0.0.1:{env.https_port}/
"""
conf.add_vhost_test1(extras=extras)
conf = LoadTestCase.setup_base_conf(env=env, extras=extras)
conf.add_vhost_test1()
conf.install()


Expand Down Expand Up @@ -784,6 +784,9 @@ def main(cls):
}

env = H2TestEnv()
setup = H2TestSetup(env=env)
env.setup_httpd(setup=setup)

rv = 0
try:
log.debug("starting tests")
Expand Down

0 comments on commit 072839d

Please sign in to comment.