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 real NAS process-inventory controls serial

pulse-triage[bot]7b64d9b66d39
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index e4313bc6e4..42e6c3bfc1 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -8603,7 +8603,7 @@ func TestInstallSHUninstallRetainsCredentialsWhenSavedURLIsMissing(t *testing.T)
}
func TestInstallSHSystemdTeardownRequiresObservedQuiescence(t *testing.T) {
- runPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_systemd_teardown.py"), "AgentSystemdTeardown", []string{
+ runParallelPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_systemd_teardown.py"), "AgentSystemdTeardown", []string{
"test_unknown_read_stop_and_disable_retain_every_artifact",
"test_unsettled_or_unknown_states_never_authorise_deletion",
"test_helper_socket_and_service_are_reconciled_together",
@@ -8629,7 +8629,7 @@ func TestInstallSHOpenRCTeardownRequiresObservedQuiescence(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("Unix shell/OpenRC controls; Windows has its own native SCM gate")
}
- runPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_openrc_teardown.py"), "AgentOpenRCTeardown", []string{
+ runParallelPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_openrc_teardown.py"), "AgentOpenRCTeardown", []string{
"test_stop_and_disable_refusals_retain_every_local_file",
"test_failed_partial_or_diagnostic_observations_are_not_replaced_by_another_read",
"test_independent_post_stop_and_runlevel_reads_are_mandatory",
@@ -8649,7 +8649,7 @@ func TestInstallSHLegacyTeardownRequiresObservedQuiescence(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("Unix rc.d/SysV controls; Windows has its own native SCM gate")
}
- runPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_legacy_teardown.py"), "AgentLegacyTeardown", []string{
+ runParallelPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_legacy_teardown.py"), "AgentLegacyTeardown", []string{
"test_stop_refusal_retains_all_local_recovery",
"test_manager_refusal_precedes_remote_and_state_erasure",
"test_ignored_stop_disable_and_reactivation_are_not_success",
@@ -8675,7 +8675,7 @@ func TestInstallSHUpstartTeardownRequiresObservedQuiescence(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("DSM Upstart shell controls; Windows has its own native SCM gate")
}
- runPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_upstart_teardown.py"), "AgentUpstartTeardown", []string{
+ runParallelPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_upstart_teardown.py"), "AgentUpstartTeardown", []string{
"test_link_fixture_preserves_exclusive_no_target_directory_semantics",
"test_link_fixture_exposes_the_old_directory_restore_race",
"test_refused_manager_precedes_remote_and_state_erasure",
@@ -8700,7 +8700,7 @@ func TestInstallSHTrueNASScaleBootTasksRetireBeforeRecoveryErasure(t *testing.T)
if runtime.GOOS == "windows" {
t.Skip("TrueNAS SCALE shell controls; Windows has its own native SCM gate")
}
- runPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_truenas_teardown.py"), "AgentTrueNASTeardown", []string{
+ runParallelPythonFixtureControls(t, repoFile("scripts", "installtests", "agent_truenas_teardown.py"), "AgentTrueNASTeardown", []string{
"test_unavailable_or_untrusted_task_inventory_cannot_remove_recovery",
"test_foreign_or_indirect_bootstrap_is_not_mutated",
"test_missing_activation_target_cannot_hide_an_owned_task",
diff --git a/scripts/installtests/pulse_auto_update_test.go b/scripts/installtests/pulse_auto_update_test.go
index a147c00f44..4bb8b1287f 100644
--- a/scripts/installtests/pulse_auto_update_test.go
+++ b/scripts/installtests/pulse_auto_update_test.go
@@ -162,7 +162,7 @@ func TestAutoUpdateDownloadFailures(t *testing.T) {
// Service-state admission is independent of the signed/metadata transaction
// matrix below; no native service or published input is used by this fixture.
func TestAutoUpdateServiceStateFailsClosed(t *testing.T) {
- runPythonFixtureControls(t, repoFile("scripts", "tests", "test_auto_update_service_state.py"), "UpdateServiceState", []string{
+ runParallelPythonFixtureControls(t, repoFile("scripts", "tests", "test_auto_update_service_state.py"), "UpdateServiceState", []string{
"test_manager_diagnostics_refuse_initial_update_and_restart",
"test_manager_diagnostics_after_install_retain_backup_without_mutation",
"test_manager_diagnostics_after_stop_retain_backup_without_restart",
@@ -176,7 +176,7 @@ func TestAutoUpdateServiceStateFailsClosed(t *testing.T) {
// Keep the full real-sink matrix mandatory, but give it its own existing-size
// bound rather than exhausting the service-state suite's manager deadlines.
func TestAutoUpdateLogSinkFailures(t *testing.T) {
- runPythonFixtureControls(t, repoFile("scripts", "tests", "test_auto_update_service_state.py"), "UpdateLogSinks", []string{
+ runParallelPythonFixtureControls(t, repoFile("scripts", "tests", "test_auto_update_service_state.py"), "UpdateLogSinks", []string{
"test_logger_double_keeps_complete_argument_frames_and_exit_sequence",
"test_real_log_retains_each_sink_failure_in_conditional_calls",
"test_real_logger_failure_drains_installer_and_preserves_recovery",
diff --git a/scripts/installtests/python_fixture_controls_test.go b/scripts/installtests/python_fixture_controls_test.go
index 2e1a3d9c92..c02a9f8ac4 100644
--- a/scripts/installtests/python_fixture_controls_test.go
+++ b/scripts/installtests/python_fixture_controls_test.go
@@ -15,12 +15,23 @@ import (
// A suite's cumulative runtime is not a service or installer deadline. Give
// each independent control the existing bound, while the native phase keeps
-// its overall Go timeout. Each method owns a separate Python process and its
-// private fixture files: use Go's bounded -parallel budget instead of adding
-// every independent manager timeout to the containing suite's critical path.
+// its overall Go timeout. Default to serial execution: private files/processes
+// alone do not isolate a control that reads the real machine-wide inventory.
// Discovery runs every method, including future ones, and the required list
// prevents deleting a safety control unnoticed.
func runPythonFixtureControls(t *testing.T, script, class string, required []string, bound time.Duration, env ...string) {
+ t.Helper()
+ runScheduledPythonFixtureControls(t, script, class, required, bound, false, env...)
+}
+
+// Opt in only classes with independent fixture state and modelled manager /
+// process inventories. Go's existing -parallel limit bounds process admission.
+func runParallelPythonFixtureControls(t *testing.T, script, class string, required []string, bound time.Duration, env ...string) {
+ t.Helper()
+ runScheduledPythonFixtureControls(t, script, class, required, bound, true, env...)
+}
+
+func runScheduledPythonFixtureControls(t *testing.T, script, class string, required []string, bound time.Duration, parallel bool, env ...string) {
t.Helper()
ctx, cancel := context.WithTimeout(context.Background(), bound)
controls, err := discoverPythonFixtureControls(ctx, script, class, required, env...)
@@ -31,7 +42,9 @@ func runPythonFixtureControls(t *testing.T, script, class string, required []str
t.Logf("Discovered %d %s controls; each retains its %s bound", len(controls), class, bound)
for _, name := range controls {
t.Run(name, func(t *testing.T) {
- t.Parallel()
+ if parallel {
+ t.Parallel()
+ }
// Start the existing per-control deadline after scheduler admission,
// never while this method is waiting for a parallel worker.
ctx, cancel := context.WithTimeout(context.Background(), bound)
@@ -48,7 +61,11 @@ func runPythonFixtureControls(t *testing.T, script, class string, required []str
func TestPythonFixtureControlsBoundedParallelExecution(t *testing.T) {
const probeRoot = "PULSE_TEST_PYTHON_CONTROL_PROBE_ROOT"
if root := os.Getenv(probeRoot); root != "" {
- runPythonFixtureControls(t, filepath.Join(root, "controls.py"), "Controls",
+ run := runParallelPythonFixtureControls
+ if _, err := os.Stat(filepath.Join(root, "serial-helper")); err == nil {
+ run = runPythonFixtureControls
+ }
+ run(t, filepath.Join(root, "controls.py"), "Controls",
[]string{"test_first", "test_second", "test_third", "test_fourth"}, 15*time.Second,
probeRoot+"="+root)
return
@@ -88,11 +105,13 @@ if __name__ == "__main__": unittest.main(verbosity=2)
for _, tc := range []struct {
name, fault, parallel, diagnostic string
passed bool
+ serialHelper bool
}{
- {"bounded parallel", "", "2", "", true},
- {"failed control", "fail", "2", "retained adverse control", false},
- {"skipped control", "skip", "2", "did not execute exactly one passing control", false},
- {"serial adverse control", "", "1", "serial control execution", false},
+ {"bounded parallel", "", "2", "", true, false},
+ {"failed control", "fail", "2", "retained adverse control", false, false},
+ {"skipped control", "skip", "2", "did not execute exactly one passing control", false, false},
+ {"serial scheduler adverse control", "", "1", "serial control execution", false, false},
+ {"serial helper preserves ordering", "", "2", "serial control execution", false, true},
} {
t.Run(tc.name, func(t *testing.T) {
root := t.TempDir()
@@ -102,6 +121,11 @@ if __name__ == "__main__": unittest.main(verbosity=2)
if err := os.WriteFile(filepath.Join(root, "fault"), []byte(tc.fault), 0600); err != nil {
t.Fatal(err)
}
+ if tc.serialHelper {
+ if err := os.WriteFile(filepath.Join(root, "serial-helper"), nil, 0600); err != nil {
+ t.Fatal(err)
+ }
+ }
binary, err := os.Executable()
if err != nil {
t.Fatal(err)