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.

Give each CI admission control its own bounded native check

pulse-triage[bot]552ac3edb006
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 235f2dad44..ce288aabc1 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -4553,12 +4553,33 @@ func TestFrontendCIRequiresCompleteIsolatedUnitProof(t *testing.T) {
// silent-mutation policy also need credential-free PR/main admission, without
// relaxing product runtime, dependency audit or receipt-only boundaries.
func TestCIIssueMetadataUsesSourceOnlyTriageChecks(t *testing.T) {
+ // This suite now includes Git history and real workflow-shell controls.
+ // Keep the existing minute bound per discovered check, not shared across
+ // a growing inventory: native macOS exhausted the aggregate deadline while
+ // completed checks were still passing. The outer Go/job alarms still apply.
+ script := repoFile("scripts", "tests", "test_ci_browser_proof_only.py")
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
- cmd := exec.CommandContext(ctx, "python3", repoFile("scripts", "tests", "test_ci_browser_proof_only.py"), "-v")
+ cmd := exec.CommandContext(ctx, "python3", script, "--list-tests")
out, err := cmd.CombinedOutput()
if err != nil {
- t.Fatalf("issue metadata CI admission and failure controls: %v\n%s", err, out)
+ t.Fatalf("discover issue metadata CI admission checks: %v (%v)\n%s", err, ctx.Err(), out)
+ }
+ names, err := ciAdmissionCaseNames(out)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, name := range names {
+ t.Run(name, func(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
+ defer cancel()
+ cmd := exec.CommandContext(ctx, "python3", script, name, "-v")
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("issue metadata CI admission check: %v (%v)\n%s", err, ctx.Err(), out)
+ }
+ t.Logf("%s", out)
+ })
}
}
diff --git a/scripts/installtests/ci_admission_inventory_test.go b/scripts/installtests/ci_admission_inventory_test.go
new file mode 100644
index 0000000000..7fb5ef701a
--- /dev/null
+++ b/scripts/installtests/ci_admission_inventory_test.go
@@ -0,0 +1,50 @@
+package installtests
+
+import (
+ "encoding/json"
+ "fmt"
+ "regexp"
+ "testing"
+)
+
+func ciAdmissionCaseNames(output []byte) ([]string, error) {
+ var names []string
+ if err := json.Unmarshal(output, &names); err != nil {
+ return nil, fmt.Errorf("invalid CI admission inventory: %w", err)
+ }
+ if len(names) == 0 {
+ return nil, fmt.Errorf("empty CI admission inventory")
+ }
+ valid := regexp.MustCompile(`^[A-Za-z_][A-Za-z_0-9]*\.test_[A-Za-z_0-9]+$`)
+ seen := make(map[string]bool)
+ for _, name := range names {
+ if !valid.MatchString(name) || seen[name] {
+ return nil, fmt.Errorf("invalid or repeated CI admission check %q", name)
+ }
+ seen[name] = true
+ }
+ return names, nil
+}
+
+func TestCIAdmissionInventoryRetainsEveryDiscoveredCheck(t *testing.T) {
+ for _, output := range []string{
+ ``, `null`, `[]`, `{}`, `[1]`, `["Case.test_one"] trailing`,
+ `["Case.test_one", "Case.test_one"]`, `["Case.test_one", ""]`,
+ `["Case.test_one", "Other"]`, `["Case.test_one", "Case.test_two --skip"]`,
+ `["Case.test_one", "Case.test_two\nCase.test_three"]`,
+ } {
+ t.Run(output, func(t *testing.T) {
+ if _, err := ciAdmissionCaseNames([]byte(output)); err == nil {
+ t.Fatal("unsafe or incomplete inventory was accepted")
+ }
+ })
+ }
+ output := `["FutureCase.test_last", "Case.test_first", "Case.test_added"]`
+ names, err := ciAdmissionCaseNames([]byte(output))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(names) != 3 || names[0] != "FutureCase.test_last" || names[1] != "Case.test_first" || names[2] != "Case.test_added" {
+ t.Fatalf("discovered checks were omitted or reordered: %v", names)
+ }
+}
diff --git a/scripts/tests/test_ci_browser_proof_only.py b/scripts/tests/test_ci_browser_proof_only.py
index 7d3fda6a38..f63fa3e6e3 100644
--- a/scripts/tests/test_ci_browser_proof_only.py
+++ b/scripts/tests/test_ci_browser_proof_only.py
@@ -3,12 +3,15 @@
import importlib.util
import fnmatch
+import json
import os
from pathlib import Path
import re
import shutil
import subprocess
+import sys
import tempfile
+import types
import unittest
from unittest.mock import patch
@@ -32,6 +35,51 @@ RECEIPT = "frontend-modern/browser-verification/2026-10-14-proof.json"
JOBS = ("tier-selection", "test-images", "e2e", "agent-registration")
+def test_case_names(module):
+ """Discover the same complete inventory as unittest, without running it."""
+ def leaves(suite):
+ for case in suite:
+ if isinstance(case, unittest.TestSuite):
+ yield from leaves(case)
+ else:
+ yield case.id().removeprefix(module.__name__ + ".")
+
+ names = list(leaves(unittest.defaultTestLoader.loadTestsFromModule(module)))
+ if not names or len(names) != len(set(names)) or any(
+ re.fullmatch(r"[A-Za-z_]\w*\.test_\w+", name) is None for name in names):
+ raise ValueError("missing, repeated or invalid CI admission test inventory")
+ return names
+
+
+class InventoryTest(unittest.TestCase):
+ def test_listing_matches_unittest_including_future_cases(self):
+ module = types.ModuleType("future_admission_fixture")
+ for name in ("FirstCase", "FutureCase"):
+ setattr(module, name, type(name, (unittest.TestCase,), {
+ "__module__": module.__name__,
+ "test_added": lambda self: None,
+ "test_last": lambda self: None,
+ }))
+ self.assertEqual(test_case_names(module), [
+ "FirstCase.test_added", "FirstCase.test_last",
+ "FutureCase.test_added", "FutureCase.test_last",
+ ])
+ listed = subprocess.run([sys.executable, str(Path(__file__)), "--list-tests"],
+ check=True, capture_output=True, text=True, timeout=10)
+ self.assertEqual(json.loads(listed.stdout), test_case_names(sys.modules[__name__]))
+
+ def test_empty_or_aliased_inventory_cannot_silently_drop_checks(self):
+ module = types.ModuleType("invalid_admission_fixture")
+ with self.assertRaises(ValueError):
+ test_case_names(module)
+ module.First = type("First", (unittest.TestCase,), {
+ "__module__": module.__name__, "test_present": lambda self: None,
+ })
+ module.Alias = module.First
+ with self.assertRaises(ValueError):
+ test_case_names(module)
+
+
def job_block(workflow, name):
match = re.search(rf"^ {re.escape(name)}:\n(.*?)(?=^ [\w-]+:\n|\Z)",
workflow, re.M | re.S)
@@ -690,4 +738,7 @@ class WorkflowScopeTest(unittest.TestCase):
if __name__ == "__main__":
- unittest.main()
+ if sys.argv[1:] == ["--list-tests"]:
+ print(json.dumps(test_case_names(sys.modules[__name__])))
+ else:
+ unittest.main()