Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Bound release API test batch arguments

rcourtmanae27ad751174
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 39a9d90ddf..63b17e3ea3 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -598,7 +598,11 @@ upgrade, update, release, or artifact-selection behavior.
deterministic manifest proving a complete, disjoint partition. Each
partition must preserve the exact order emitted by that binary; sorting or
hash distribution is not equivalent while legacy tests still exercise
- package-global state. Two API shards and the remaining Go packages may then
+ package-global state. Each shard must split only at deterministic contiguous
+ batch boundaries whose encoded `-test.run` regex stays below the configured
+ per-argument byte ceiling, so a memory-driven one-shard fallback cannot
+ exceed the operating system's exec limit before tests begin. Two API shards
+ and the remaining Go packages may then
execute concurrently with isolated data directories. A failed shard must
fail the complete backend gate and terminate every descendant test process;
sharding must never select a coverage subset or leave orphan race binaries
@@ -1594,6 +1598,14 @@ and manifests from that exact source run; it must not rebuild release binaries
after qualification. Post-publication Helm and paid-runtime convergence likewise
consume source-run artifacts and retain exact-SHA, installer, signature,
public/private artifact, and definitive convergence proof.
+Release run `32493044910` exposed the memory-driven one-shard backend fallback
+before publication: all 3,736 top-level API tests were encoded into one
+`-test.run` argument and Linux rejected the invocation with `Argument list too
+long` before any API test executed. The canonical planner now bounds each
+deterministic contiguous batch by encoded regex bytes as well as test count.
+That failed run and its inert private staging child were cancelled; no public
+tag or GitHub release was created, and the corrected candidate must run from a
+new exact source SHA.
The publish body keeps its `Highlights` section within the governed three-item
limit while preserving the packet's operator-facing summary of read-only
observer coverage, estate-first platform search and facets, and real delivery-
diff --git a/docs/releases/RELEASE_NOTES_v6.3.0-rc.5.md b/docs/releases/RELEASE_NOTES_v6.3.0-rc.5.md
index 366e9af371..51010eed97 100644
--- a/docs/releases/RELEASE_NOTES_v6.3.0-rc.5.md
+++ b/docs/releases/RELEASE_NOTES_v6.3.0-rc.5.md
@@ -65,6 +65,9 @@ source commit that passed qualification.
- Candidate qualification now runs even when intentionally disabled native
signing jobs are skipped, while still failing closed on a required signing
failure.
+- Backend qualification now byte-bounds deterministic API test batches, so a
+ memory-driven one-shard fallback cannot exceed the operating system's exec
+ argument limit before any tests run.
## Security
diff --git a/docs/releases/V6_CHANGELOG_v6.3.0-rc.5.md b/docs/releases/V6_CHANGELOG_v6.3.0-rc.5.md
index ac88196b08..a668cb3fa1 100644
--- a/docs/releases/V6_CHANGELOG_v6.3.0-rc.5.md
+++ b/docs/releases/V6_CHANGELOG_v6.3.0-rc.5.md
@@ -41,6 +41,8 @@ forward the complete 6.3 product packet and rolls back to stable `v6.2.1`._
are validated according to their actual release contract.
- Release activation and private child-workflow polling no longer add long
fixed delays after evidence becomes available.
+- Deterministic API test batches now enforce an encoded regex byte ceiling, so
+ the low-memory one-shard path remains executable without reducing coverage.
## Security
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 4e0635cc39..b80ae14025 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -2717,6 +2717,7 @@ func TestReleaseBackendRaceGateUsesCompletePVEPartition(t *testing.T) {
for _, needle := range []string{
"go test -c -race",
"python3 scripts/shard_go_tests.py",
+ `--max-regex-bytes "$MAX_REGEX_BYTES"`,
"go test -race -timeout 30m",
`-test.timeout 30m`,
} {
diff --git a/scripts/release_control/internal/release_preflight_test.py b/scripts/release_control/internal/release_preflight_test.py
index 3842c44ae7..578972e874 100755
--- a/scripts/release_control/internal/release_preflight_test.py
+++ b/scripts/release_control/internal/release_preflight_test.py
@@ -150,6 +150,43 @@ class ReleasePreflightTest(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "cannot exceed"):
build_plan(["TestOnly"], 2, 10)
+ def test_api_shard_plan_bounds_one_shard_regex_argument_bytes(self) -> None:
+ test_names = [
+ f"TestReleaseIntegrationCase{index:04d}{'X' * 64}"
+ for index in range(3736)
+ ]
+ max_regex_bytes = 64 * 1024
+ plan = build_plan(
+ test_names,
+ shard_count=1,
+ batch_size=10000,
+ max_regex_bytes=max_regex_bytes,
+ )
+ batches = plan["shards"][0]["batches"]
+ self.assertGreater(len(batches), 1)
+ self.assertEqual(
+ [name for batch in batches for name in batch],
+ test_names,
+ )
+
+ with tempfile.TemporaryDirectory() as directory:
+ write_plan(plan, pathlib.Path(directory))
+ regex_files = sorted(pathlib.Path(directory).glob("*.regex"))
+ self.assertEqual(len(regex_files), len(batches))
+ for regex_file in regex_files:
+ self.assertLessEqual(
+ len(regex_file.read_text().strip().encode()),
+ max_regex_bytes,
+ )
+
+ with self.assertRaisesRegex(ValueError, "exceeds max regex bytes"):
+ build_plan(
+ ["TestNameThatCannotFit"],
+ shard_count=1,
+ batch_size=1,
+ max_regex_bytes=8,
+ )
+
def test_release_workflow_uses_independent_pve_bundle_and_backend_lanes(self) -> None:
workflow = (ROOT / ".github/workflows/create-release.yml").read_text()
backend = (ROOT / "scripts/run-release-backend-tests.sh").read_text()
@@ -157,9 +194,13 @@ class ReleasePreflightTest(unittest.TestCase):
self.assertIn("runs-on: [self-hosted, Linux, X64, pulse-pve-build]", workflow)
self.assertIn("runs-on: [self-hosted, Linux, X64, pulse-pve-tests]", workflow)
self.assertIn("./scripts/run-release-backend-tests.sh", workflow)
- self.assertNotIn(" - frontend_checks\n if:", workflow[workflow.index(" backend_tests:"):workflow.index(" docker_build:")])
+ backend_job = workflow[
+ workflow.index(" backend_tests:") : workflow.index(" integration_tests:")
+ ]
+ self.assertNotIn(" - frontend_checks\n if:", backend_job)
self.assertIn("go test -c -race", backend)
self.assertIn("python3 scripts/shard_go_tests.py", backend)
+ self.assertIn('--max-regex-bytes "$MAX_REGEX_BYTES"', backend)
self.assertIn("export GITHUB_ACTIONS=true", backend)
self.assertIn("export CI=true", backend)
diff --git a/scripts/run-release-backend-tests.sh b/scripts/run-release-backend-tests.sh
index 2706b2f636..d12f495972 100755
--- a/scripts/run-release-backend-tests.sh
+++ b/scripts/run-release-backend-tests.sh
@@ -9,12 +9,15 @@ Options:
--data-root DIR Isolated test-data root (required)
--api-shards VALUE auto or a positive integer (default: auto)
--batch-size VALUE Top-level tests per API test-binary invocation (default: 10000)
+ --max-regex-bytes VALUE
+ Maximum encoded -test.run regex bytes (default: 65536)
EOF
}
DATA_ROOT=""
API_SHARDS="${PULSE_BACKEND_TEST_SHARDS:-auto}"
BATCH_SIZE=10000
+MAX_REGEX_BYTES="${PULSE_BACKEND_TEST_MAX_REGEX_BYTES:-65536}"
while [ "$#" -gt 0 ]; do
case "$1" in
@@ -30,6 +33,10 @@ while [ "$#" -gt 0 ]; do
BATCH_SIZE="${2:-}"
shift 2
;;
+ --max-regex-bytes)
+ MAX_REGEX_BYTES="${2:-}"
+ shift 2
+ ;;
-h|--help)
usage
exit 0
@@ -50,6 +57,10 @@ if [[ ! "$BATCH_SIZE" =~ ^[1-9][0-9]*$ ]]; then
echo "Error: --batch-size must be a positive integer." >&2
exit 2
fi
+if [[ ! "$MAX_REGEX_BYTES" =~ ^[1-9][0-9]*$ ]]; then
+ echo "Error: --max-regex-bytes must be a positive integer." >&2
+ exit 2
+fi
for command_name in go python3 getconf awk pgrep; do
if ! command -v "$command_name" >/dev/null 2>&1; then
@@ -95,6 +106,7 @@ echo " vCPUs: $VCPUS"
echo " Available MiB: $((AVAILABLE_KIB / 1024))"
echo " API shards: $API_SHARDS"
echo " Batch size: $BATCH_SIZE"
+echo " Regex bytes: $MAX_REGEX_BYTES max"
./scripts/ensure_test_assets.sh
@@ -109,6 +121,7 @@ python3 scripts/shard_go_tests.py \
--tests-file "$TEST_NAMES_FILE" \
--shards "$API_SHARDS" \
--batch-size "$BATCH_SIZE" \
+ --max-regex-bytes "$MAX_REGEX_BYTES" \
--output-dir "$PLAN_DIR"
API_IMPORT_PATH="$(go list -f '{{.ImportPath}}' ./internal/api)"
diff --git a/scripts/shard_go_tests.py b/scripts/shard_go_tests.py
index 9171d8f3c5..ff4fb654e4 100755
--- a/scripts/shard_go_tests.py
+++ b/scripts/shard_go_tests.py
@@ -12,6 +12,7 @@ from typing import Sequence
TEST_NAME_PATTERN = re.compile(r"^Test[A-Za-z0-9_]+$")
+DEFAULT_MAX_REGEX_BYTES = 64 * 1024
def _digest(names: Sequence[str]) -> str:
@@ -19,13 +20,45 @@ def _digest(names: Sequence[str]) -> str:
return hashlib.sha256(payload).hexdigest()
+def _test_regex(names: Sequence[str]) -> str:
+ return "^(?:" + "|".join(re.escape(name) for name in names) + ")$"
+
+
+def _batch_names(
+ names: Sequence[str], batch_size: int, max_regex_bytes: int
+) -> list[list[str]]:
+ batches: list[list[str]] = []
+ current: list[str] = []
+ for name in names:
+ candidate = [*current, name]
+ candidate_bytes = len(_test_regex(candidate).encode())
+ if current and (len(candidate) > batch_size or candidate_bytes > max_regex_bytes):
+ batches.append(current)
+ current = [name]
+ candidate_bytes = len(_test_regex(current).encode())
+ else:
+ current = candidate
+ if candidate_bytes > max_regex_bytes:
+ raise ValueError(
+ f"top-level Go test name exceeds max regex bytes: {name}"
+ )
+ if current:
+ batches.append(current)
+ return batches
+
+
def build_plan(
- test_names: Sequence[str], shard_count: int, batch_size: int
+ test_names: Sequence[str],
+ shard_count: int,
+ batch_size: int,
+ max_regex_bytes: int = DEFAULT_MAX_REGEX_BYTES,
) -> dict[str, object]:
if shard_count < 1:
raise ValueError("shard_count must be at least 1")
if batch_size < 1:
raise ValueError("batch_size must be at least 1")
+ if max_regex_bytes < 1:
+ raise ValueError("max_regex_bytes must be at least 1")
if not test_names:
raise ValueError("the Go package did not expose any top-level tests")
if shard_count > len(test_names):
@@ -58,10 +91,7 @@ def build_plan(
for shard_index, names in enumerate(shards, start=1):
ordered_names = list(names)
assigned.extend(ordered_names)
- batches = [
- ordered_names[offset : offset + batch_size]
- for offset in range(0, len(ordered_names), batch_size)
- ]
+ batches = _batch_names(ordered_names, batch_size, max_regex_bytes)
shard_records.append(
{
"index": shard_index,
@@ -80,6 +110,7 @@ def build_plan(
"test_names_sha256": _digest(canonical),
"shard_count": shard_count,
"batch_size": batch_size,
+ "max_regex_bytes": max_regex_bytes,
"shards": shard_records,
}
@@ -93,7 +124,7 @@ def write_plan(plan: dict[str, object], output_dir: Path) -> Path:
batch_records: list[dict[str, object]] = []
for batch_index, names in enumerate(batches, start=1):
filename = f"shard-{shard_record['index']:02d}-batch-{batch_index:02d}.regex"
- regex = "^(?:" + "|".join(re.escape(name) for name in names) + ")$"
+ regex = _test_regex(names)
(output_dir / filename).write_text(f"{regex}\n")
batch_records.append(
{
@@ -118,6 +149,9 @@ def main() -> int:
parser.add_argument("--tests-file", type=Path, required=True)
parser.add_argument("--shards", type=int, required=True)
parser.add_argument("--batch-size", type=int, default=10000)
+ parser.add_argument(
+ "--max-regex-bytes", type=int, default=DEFAULT_MAX_REGEX_BYTES
+ )
parser.add_argument("--output-dir", type=Path, required=True)
args = parser.parse_args()
@@ -126,7 +160,9 @@ def main() -> int:
for line in args.tests_file.read_text().splitlines()
if line.strip()
]
- plan = build_plan(test_names, args.shards, args.batch_size)
+ plan = build_plan(
+ test_names, args.shards, args.batch_size, args.max_regex_bytes
+ )
manifest_path = write_plan(plan, args.output_dir)
print(manifest_path.read_text(), end="")
return 0