aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/test_basic.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-06-28 12:56:18 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-06-28 19:12:54 +0200
commitc52e9a6429e9293265ed7912565ee3d1c5fd3217 (patch)
tree97afc850d7e973ddc0916ceb4f76b06ae2117351 /test/test_basic.py
parenttest/lib: refactoring (diff)
downloadcimple-c52e9a6429e9293265ed7912565ee3d1c5fd3217.tar.gz
cimple-c52e9a6429e9293265ed7912565ee3d1c5fd3217.zip
test: add test for actual CI runs
Diffstat (limited to '')
-rw-r--r--test/test_basic.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_basic.py b/test/test_basic.py
index b072384..7deca0f 100644
--- a/test/test_basic.py
+++ b/test/test_basic.py
@@ -5,6 +5,8 @@
import pytest
+from .lib.process import LoggingEvent
+
def test_server_and_workers_run(server_and_workers):
pass
@@ -14,3 +16,36 @@ def test_client_version(client, version):
ec, output = client.run('--version')
assert ec == 0
assert output.endswith(version + '\n')
+
+
+class LoggingEventRunComplete(LoggingEvent):
+ def __init__(self, target):
+ self.counter = 0
+ self.target = target
+ super().__init__(timeout=60)
+
+ def log_line_matches(self, line):
+ return 'Received a "run complete" message from worker' in line
+
+ def set(self):
+ self.counter += 1
+ if self.counter == self.target:
+ super().set()
+
+
+def _test_repo_internal(server_and_workers, test_repo, client, numof_runs):
+ server, workers = server_and_workers
+ event = LoggingEventRunComplete(numof_runs)
+ server.logger.add_event(event)
+ for i in range(numof_runs):
+ client.run('run', test_repo.path, 'HEAD')
+ 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_10(server_and_workers, test_repo, client):
+ _test_repo_internal(server_and_workers, test_repo, client, 10)