diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-06 00:52:09 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-06 00:52:09 +0200 |
commit | 221cb97073b2a0bafe644d709a4c7c7bd3f803bc (patch) | |
tree | 61083aa35a09e5c2deec7d509eedf4b63c09e875 /test | |
parent | test: add a 2000-iteration basic repository test (diff) | |
download | cimple-221cb97073b2a0bafe644d709a4c7c7bd3f803bc.tar.gz cimple-221cb97073b2a0bafe644d709a4c7c7bd3f803bc.zip |
test: add one more stress test
Diffstat (limited to 'test')
-rw-r--r-- | test/py/test_repo.py | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/test/py/test_repo.py b/test/py/test_repo.py index 2c995e1..782240b 100644 --- a/test/py/test_repo.py +++ b/test/py/test_repo.py @@ -3,6 +3,8 @@ # For details, see https://github.com/egor-tensin/cimple. # Distributed under the MIT License. +from multiprocessing import Process + import pytest from lib.process import LoggingEvent @@ -23,32 +25,46 @@ class LoggingEventRunComplete(LoggingEvent): super().set() -def _test_repo_internal(server_and_workers, test_repo, client, numof_runs): +def _test_repo_internal(server_and_workers, test_repo, client, numof_processes, runs_per_process): + numof_runs = numof_processes * runs_per_process + server, workers = server_and_workers event = LoggingEventRunComplete(numof_runs) # Count the number of times the server receives the "run complete" message. server.logger.add_event(event) - for i in range(numof_runs): - client.run('run', test_repo.path, 'HEAD') + def client_runner(): + for i in range(runs_per_process): + client.run('run', test_repo.path, 'HEAD') + + processes = [Process(target=client_runner) for i in range(numof_processes)] + for proc in processes: + proc.start() + for proc in processes: + proc.join() event.wait() assert numof_runs == test_repo.count_ci_output_files() -def test_repo(server_and_workers, test_repo, client): - _test_repo_internal(server_and_workers, test_repo, client, 1) +def test_repo_1_client_1_run(server_and_workers, test_repo, client): + _test_repo_internal(server_and_workers, test_repo, client, 1, 1) -def test_repo_2(server_and_workers, test_repo, client): - _test_repo_internal(server_and_workers, test_repo, client, 2) +def test_repo_1_client_2_runs(server_and_workers, test_repo, client): + _test_repo_internal(server_and_workers, test_repo, client, 1, 2) -def test_repo_10(server_and_workers, test_repo, client): - _test_repo_internal(server_and_workers, test_repo, client, 10) +def test_repo_1_client_10_runs(server_and_workers, test_repo, client): + _test_repo_internal(server_and_workers, test_repo, client, 1, 10) + + +@pytest.mark.stress +def test_repo_1_client_2000_runs(server_and_workers, test_repo, client): + _test_repo_internal(server_and_workers, test_repo, client, 1, 2000) @pytest.mark.stress -def test_repo_2000(server_and_workers, test_repo, client): - _test_repo_internal(server_and_workers, test_repo, client, 2000) +def test_repo_4_clients_500_runs(server_and_workers, test_repo, client): + _test_repo_internal(server_and_workers, test_repo, client, 4, 500) |