From 96dfd67633477a320f3dcb89e18a1014640b0d1b Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 13 Jan 2026 14:35:03 +0100 Subject: [PATCH] Adjust test --- changedetectionio/run_basic_tests.sh | 2 +- changedetectionio/tests/test_history_consistency.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changedetectionio/run_basic_tests.sh b/changedetectionio/run_basic_tests.sh index d4f3db8fe..12cc5e685 100755 --- a/changedetectionio/run_basic_tests.sh +++ b/changedetectionio/run_basic_tests.sh @@ -98,7 +98,7 @@ pytest -vv -s --maxfail=1 tests/test_rss.py pytest -vv -s --maxfail=1 tests/test_unique_lines.py # Try high concurrency -FETCH_WORKERS=130 pytest tests/test_history_consistency.py -v -l +FETCH_WORKERS=50 pytest tests/test_history_consistency.py -vv -l -s # Check file:// will pickup a file when enabled echo "Hello world" > /tmp/test-file.txt diff --git a/changedetectionio/tests/test_history_consistency.py b/changedetectionio/tests/test_history_consistency.py index 05fc53169..b1af88b29 100644 --- a/changedetectionio/tests/test_history_consistency.py +++ b/changedetectionio/tests/test_history_consistency.py @@ -35,11 +35,16 @@ def test_consistent_history(client, live_server, measure_memory_usage, datastore wait_for_all_checks(client) duration = time.time() - now per_worker = duration/sys_fetch_workers - per_worker_threshold=0.5 + if sys_fetch_workers < 20: + per_worker_threshold=0.3 + elif sys_fetch_workers < 50: + per_worker_threshold = 0.8 + else: + per_worker_threshold = 1.5 logger.debug(f"All fetched in {duration:.2f}s, {per_worker}s per worker") - assert per_worker < per_worker_threshold, f"If concurrency is working good, no blocking async problems, each worker should have done his job in under {per_worker_threshold}s, got {per_worker:.2f}s per worker, total duration was {duration:.2f}s" + assert per_worker < per_worker_threshold, f"If concurrency is working good, no blocking async problems, each worker ({sys_fetch_workers} workers) should have done his job in under {per_worker_threshold}s, got {per_worker:.2f}s per worker, total duration was {duration:.2f}s" # Essentially just triggers the DB write/update res = client.post(