aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/py/test_repo.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/py/test_repo.py')
-rw-r--r--test/py/test_repo.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/test/py/test_repo.py b/test/py/test_repo.py
index 782240b..1cc1434 100644
--- a/test/py/test_repo.py
+++ b/test/py/test_repo.py
@@ -4,6 +4,7 @@
# Distributed under the MIT License.
from multiprocessing import Process
+import re
import pytest
@@ -14,10 +15,11 @@ class LoggingEventRunComplete(LoggingEvent):
def __init__(self, target):
self.counter = 0
self.target = target
+ self.re = re.compile(r'run \d+ as finished')
super().__init__(timeout=60)
def log_line_matches(self, line):
- return 'Received a "run finished" message from worker' in line
+ return bool(self.re.search(line))
def set(self):
self.counter += 1
@@ -25,7 +27,7 @@ class LoggingEventRunComplete(LoggingEvent):
super().set()
-def _test_repo_internal(server_and_workers, test_repo, client, numof_processes, runs_per_process):
+def _test_repo_internal(server_and_workers, test_repo, client, numof_processes, runs_per_process, db):
numof_runs = numof_processes * runs_per_process
server, workers = server_and_workers
@@ -47,24 +49,30 @@ def _test_repo_internal(server_and_workers, test_repo, client, numof_processes,
event.wait()
assert numof_runs == test_repo.count_ci_output_files()
+ runs = db.get_all_runs()
+ assert numof_runs == len(runs)
-def test_repo_1_client_1_run(server_and_workers, test_repo, client):
- _test_repo_internal(server_and_workers, test_repo, client, 1, 1)
+ for id, status, ec, output, url, rev in runs:
+ assert status == 'finished', f'Invalid status for run {id}: {status}'
-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_1_client_1_run(server_and_workers, test_repo, client, sqlite_db):
+ _test_repo_internal(server_and_workers, test_repo, client, 1, 1, sqlite_db)
-def test_repo_1_client_10_runs(server_and_workers, test_repo, client):
- _test_repo_internal(server_and_workers, test_repo, client, 1, 10)
+def test_repo_1_client_2_runs(server_and_workers, test_repo, client, sqlite_db):
+ _test_repo_internal(server_and_workers, test_repo, client, 1, 2, sqlite_db)
+
+
+def test_repo_1_client_10_runs(server_and_workers, test_repo, client, sqlite_db):
+ _test_repo_internal(server_and_workers, test_repo, client, 1, 10, sqlite_db)
@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)
+def test_repo_1_client_2000_runs(server_and_workers, test_repo, client, sqlite_db):
+ _test_repo_internal(server_and_workers, test_repo, client, 1, 2000, sqlite_db)
@pytest.mark.stress
-def test_repo_4_clients_500_runs(server_and_workers, test_repo, client):
- _test_repo_internal(server_and_workers, test_repo, client, 4, 500)
+def test_repo_4_clients_500_runs(server_and_workers, test_repo, client, sqlite_db):
+ _test_repo_internal(server_and_workers, test_repo, client, 4, 500, sqlite_db)