test(backend): share the integration timeout budget between shards

This commit is contained in:
shira committed 2026-10-10 18:05:44 +03:00
1 parent d8abaae85b
commit d6f960f8ae
4 files changed
+26 -3

No files matched your search

+12 -1
View File
@@ -10,6 +10,17 @@ import subprocess
import sys
from collections import defaultdict
# Time budget of the whole suite. CI runs it in two shards of ten minutes, so a
# shard gets its share of the budget and never less than ten minutes, and an
# unsharded local run gets the whole budget.
SUITE_TIMEOUT_MINUTES = 20
SHARD_TIMEOUT_FLOOR_MINUTES = 10
def go_timeout(total):
share = -(-SUITE_TIMEOUT_MINUTES // total)
return f"{max(SHARD_TIMEOUT_FLOOR_MINUTES, share)}m"
def shard_settings():
index = os.environ.get("TEST_SHARD_INDEX")
@@ -73,7 +84,7 @@ def run():
# Go splits -run at slashes. Anchoring only the parent keeps all its subtests.
pattern = "^(" + "|".join(re.escape(name) for name in names) + ")$"
subprocess.run([
*go, "test", "-tags=integration", "-count=1", "-timeout=10m",
*go, "test", "-tags=integration", "-count=1", "-timeout=" + go_timeout(total),
"-run=" + pattern, package,
], check=True)