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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep browser guard Git fixtures free of background writers
pulse-triage[bot]53b516c56059
diff --git a/scripts/release_control/browser_verification_guard_test.py b/scripts/release_control/browser_verification_guard_test.pyindex 1be6526b75..1dead68019 100644--- a/scripts/release_control/browser_verification_guard_test.py+++ b/scripts/release_control/browser_verification_guard_test.py@@ -52,6 +52,32 @@ def valid_receipt() -> dict:}+def fixture_git_env() -> dict[str, str]:+ env = strip_local_git_env(os.environ.copy())+ # Runner configuration must not start background writers in a repository+ # whose lifetime ends as soon as a test's synchronous commands finish.+ env["GIT_CONFIG_GLOBAL"] = os.devnull+ env["GIT_CONFIG_SYSTEM"] = os.devnull+ return env+++def disable_fixture_git_background_tasks(repo_root: Path, env: dict[str, str]) -> None:+ # Store these locally: the guard itself invokes bare git, not our helper.+ # Keep TemporaryDirectory cleanup strict rather than hiding a live writer.+ for key, value in (+ ("gc.auto", "0"),+ ("maintenance.auto", "false"),+ ("core.fsmonitor", "false"),+ ):+ subprocess.run(+ ["git", "config", "--local", key, value],+ cwd=repo_root,+ check=True,+ capture_output=True,+ env=env,+ )++class BrowserVerificationGuardTest(unittest.TestCase):def test_pre_commit_formats_frontend_before_validating_receipt_hashes(self) -> None:hook = (REPO_ROOT / ".husky" / "pre-commit").read_text(encoding="utf-8")@@ -190,7 +216,7 @@ class FormattingOnlyExemptionTest(unittest.TestCase):source = repo_root / CHANGED_PATHsource.parent.mkdir(parents=True)source.write_text(old, encoding="utf-8")- env = strip_local_git_env(os.environ.copy())+ env = fixture_git_env()def git(*args: str) -> None:subprocess.run(@@ -198,6 +224,7 @@ class FormattingOnlyExemptionTest(unittest.TestCase):)git("init")+ disable_fixture_git_background_tasks(repo_root, env)git("add", CHANGED_PATH)git("-c", "[email protected]", "-c", "user.name=t", "commit", "-m", "seed")source.write_text(new, encoding="utf-8")@@ -207,7 +234,7 @@ class FormattingOnlyExemptionTest(unittest.TestCase):def resolve(self, repo_root: Path) -> set[str]:# Under the pre-commit hook, GIT_DIR and GIT_INDEX_FILE are exported# and would point this temp repo's plumbing at the real repository.- with patch.dict("os.environ", strip_local_git_env(os.environ.copy()), clear=True):+ with patch.dict("os.environ", fixture_git_env(), clear=True):with patch("browser_verification_guard.REPO_ROOT", repo_root):return formatting_only_paths([CHANGED_PATH], commit=None, repo_root=repo_root)@@ -251,9 +278,10 @@ class GuardRepoTestCase(unittest.TestCase):self.repo_root = Path(self.tmpdir.name)# Under the pre-commit hook, GIT_DIR and GIT_INDEX_FILE are exported# and would point this temp repo's plumbing at the real repository.- self.env = strip_local_git_env(os.environ.copy())+ self.env = fixture_git_env()self.env["PULSE_PRETTIER_BIN"] = str(self.repo_root / "missing-prettier")self.git("init", "--quiet", "--initial-branch=main")+ disable_fixture_git_background_tasks(self.repo_root, self.env)self.write(CHANGED_PATH, "export const a = 0;\n")self.write(OTHER_PATH, "export const b = 0;\n")self.base = self.commit("seed")@@ -886,5 +914,65 @@ class PruneTest(GuardRepoTestCase):self.assertEqual(len(self.receipts_in_tree()), 1)+ def test_pruning_merges_do_not_start_background_git_maintenance(self) -> None:+ with tempfile.TemporaryDirectory() as tmpdir:+ trace = Path(tmpdir) / "git-trace.jsonl"+ self.env["GIT_TRACE2_EVENT"] = str(trace)+ self.test_pruning_never_conflicts_with_an_open_frontend_change()+ events = [json.loads(line) for line in trace.read_text().splitlines()]++ children = [event["argv"] for event in events if event.get("event") == "child_start"]+ self.assertTrue(events, "exercise real Git, including both merge orders")+ self.assertFalse(+ [argv for argv in children if "maintenance" in argv or "gc" in argv],+ children,+ )+++class FixtureGitIsolationTest(unittest.TestCase):+ def test_both_fixture_builders_ignore_host_config_and_disable_background_writers(self) -> None:+ with tempfile.TemporaryDirectory() as tmpdir:+ host_config = Path(tmpdir) / "host.gitconfig"+ host_config.write_text(+ "[gc]\n\tauto = 1\n[maintenance]\n\tauto = true\n"+ "[core]\n\tfsmonitor = true\n[fixture]\n\thost = leaked\n",+ encoding="utf-8",+ )+ with patch.dict(os.environ, {+ "GIT_CONFIG_GLOBAL": str(host_config),+ "GIT_CONFIG_SYSTEM": str(host_config),+ "GIT_DIR": str(Path(tmpdir) / "wrong-repository"),+ "GIT_INDEX_FILE": str(Path(tmpdir) / "wrong-index"),+ }):+ fixture = GuardRepoTestCase()+ try:+ fixture.setUp()+ formatting_root = Path(tmpdir) / "formatting"+ formatting_root.mkdir()+ FormattingOnlyExemptionTest().build_repo(+ str(formatting_root), "const x = 1;\n", "const x = 2;\n"+ )+ for root in (fixture.repo_root, formatting_root):+ for key, expected in (+ ("gc.auto", "0"),+ ("maintenance.auto", "false"),+ ("core.fsmonitor", "false"),+ ):+ with self.subTest(root=root.name, key=key):+ result = subprocess.run(+ ["git", "config", "--get", key], cwd=root,+ env=fixture.env, capture_output=True, text=True, check=True,+ )+ self.assertEqual(result.stdout.strip(), expected)+ missing = subprocess.run(+ ["git", "config", "--get", "fixture.host"], cwd=root,+ env=fixture.env, capture_output=True, text=True,+ )+ self.assertEqual(missing.returncode, 1)+ self.assertEqual(missing.stdout, "")+ finally:+ self.assertTrue(fixture.doCleanups(), "temporary Git cleanup must succeed")++if __name__ == "__main__":unittest.main()