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.

Keep rest-shard validation fatal with optional cache transport

pulse-triage[bot]cf7db40103cc
diff --git a/scripts/release_control/run_go_package_slice_test.py b/scripts/release_control/run_go_package_slice_test.py
index e13f61161f..037491bf9e 100644
--- a/scripts/release_control/run_go_package_slice_test.py
+++ b/scripts/release_control/run_go_package_slice_test.py
@@ -1,5 +1,6 @@
"""Exercise the actual sliced Go runner, recorder and required-check verdict."""
+import copy
import importlib.util
import json
import os
@@ -11,6 +12,8 @@ import tempfile
import unittest
from unittest.mock import patch
+import yaml
+
ROOT = Path(__file__).resolve().parents[2]
RUNNER = ROOT / "scripts/release_control/run_go_package_slice.py"
@@ -228,10 +231,66 @@ class WorkflowTest(unittest.TestCase):
'name: backend-slices-${{ matrix.shard }}',
):
self.assertIn(expected, block)
- self.assertNotIn('continue-on-error', block)
+ self.assert_backend_validation_remains_fatal(
+ yaml.safe_load(WORKFLOW.read_text())['jobs']['backend'])
self.assertNotIn(' backend-slow:', WORKFLOW.read_text())
self.assertNotIn(' backend-packages:', WORKFLOW.read_text())
+ def assert_backend_validation_remains_fatal(self, job):
+ # Object transport may miss or fail without changing validation. Only
+ # the complete pinned, read-only restore can be optional: not the job,
+ # admission, source-listed task queue or its coverage upload.
+ self.assertNotIn('continue-on-error', job)
+ prefix = ("backend-race-objects-v1-${{ runner.os }}-${{ runner.arch }}-ubuntu24-"
+ "${{ steps.go-setup.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}-")
+ optional_restore = {
+ 'name': 'Restore backend race build objects',
+ 'if': "needs.changes.outputs.code == 'true'",
+ 'id': 'race-cache',
+ 'continue-on-error': True,
+ 'uses': 'actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9',
+ 'with': {'path': '${{ steps.go-build-cache.outputs.path }}',
+ 'key': prefix + '${{ github.sha }}', 'restore-keys': prefix},
+ }
+ optional_steps = [step for step in job['steps'] if 'continue-on-error' in step]
+ self.assertLessEqual(len(optional_steps), 1)
+ for step in optional_steps:
+ self.assertEqual(step, optional_restore)
+
+ def test_optional_cache_cannot_mask_admission_tests_or_coverage(self):
+ job = yaml.safe_load(WORKFLOW.read_text())['jobs']['backend']
+ self.assert_backend_validation_remains_fatal(job)
+ no_cache = copy.deepcopy(job)
+ no_cache['steps'] = [step for step in no_cache['steps'] if step.get('id') != 'race-cache']
+ self.assert_backend_validation_remains_fatal(no_cache)
+ for name in ('Require compiled backend tests',
+ 'Go unit tests (shard ${{ matrix.shard }})',
+ 'Retain source-listed backend coverage'):
+ with self.subTest(masked_step=name):
+ changed = copy.deepcopy(job)
+ next(step for step in changed['steps'] if step['name'] == name)['continue-on-error'] = True
+ with self.assertRaises(AssertionError):
+ self.assert_backend_validation_remains_fatal(changed)
+ changed = copy.deepcopy(job)
+ changed['continue-on-error'] = True
+ with self.assertRaises(AssertionError):
+ self.assert_backend_validation_remains_fatal(changed)
+ for field, value in (
+ ('uses', 'actions/cache/restore@main'),
+ ('uses', 'actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9'),
+ ('run', 'exit 0'), ('if', 'always()'),
+ ('with', {'path': '${{ github.workspace }}'})):
+ with self.subTest(cache_drift=(field, value)):
+ changed = copy.deepcopy(job)
+ next(step for step in changed['steps'] if step.get('id') == 'race-cache')[field] = value
+ with self.assertRaises(AssertionError):
+ self.assert_backend_validation_remains_fatal(changed)
+ changed = copy.deepcopy(job)
+ changed['steps'].append(copy.deepcopy(next(
+ step for step in job['steps'] if step.get('id') == 'race-cache')))
+ with self.assertRaises(AssertionError):
+ self.assert_backend_validation_remains_fatal(changed)
+
def test_actual_worker_recipe_waits_for_both_slices_and_ordinary_failures(self):
fixture = ExecutedRunnerTest()
fixture.setUp()
diff --git a/scripts/tests/test_go_package_slices.py b/scripts/tests/test_go_package_slices.py
new file mode 100644
index 0000000000..bf3cd7917a
--- /dev/null
+++ b/scripts/tests/test_go_package_slices.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+"""Include the runtime worker's contract controls in ordinary smoke discovery."""
+
+import importlib.util
+from pathlib import Path
+import unittest
+
+
+ROOT = Path(__file__).resolve().parents[2]
+SPEC = importlib.util.spec_from_file_location(
+ "go_package_slice_tests", ROOT / "scripts/release_control/run_go_package_slice_test.py")
+TESTS = importlib.util.module_from_spec(SPEC)
+SPEC.loader.exec_module(TESTS)
+
+
+def load_tests(loader, tests, pattern):
+ return loader.loadTestsFromModule(TESTS)
+
+
+if __name__ == "__main__":
+ unittest.main()