From 7ff7399e67f82e13382931580f5f7682b27d7a97 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 04:29:50 -0400 Subject: [PATCH] test: make the event-triggers storage-failure case order independent TestEventTriggersRejectInvalidAndUnpersistedRules pointed RuntimeConfigFile at an empty temp directory. saveLocked removes an unwritable runtime path and retries, so the retry succeeded and the save was reported persisted; the 500 only appeared when an earlier test left the overlay layer failing. Use a path under a missing directory so every layer fails deterministically. Closes #15996 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/dashboard/api_event_triggers_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pkg/dashboard/api_event_triggers_test.go b/src/pkg/dashboard/api_event_triggers_test.go index 926b33718d..6bb0181aa0 100644 --- a/src/pkg/dashboard/api_event_triggers_test.go +++ b/src/pkg/dashboard/api_event_triggers_test.go @@ -174,7 +174,14 @@ func TestEventTriggersRejectInvalidAndUnpersistedRules(t *testing.T) { t.Fatalf("failed persistence accepted: %d %s", failed.Code, failed.Body.String()) } cfg.SourcePath = t.TempDir() - config.RuntimeConfigFile, config.DashboardOverlayFile = t.TempDir(), t.TempDir() + // Every layer must fail regardless of test order. An empty directory is + // not enough for the runtime path: saveLocked removes it and retries + // (the root-owned-file recovery), and the retry succeeds. A file under + // a directory that does not exist fails the write, the remove and the + // retry alike. + missingDir := filepath.Join(t.TempDir(), "missing") + config.RuntimeConfigFile = filepath.Join(missingDir, "hive.yaml.runtime") + config.DashboardOverlayFile = filepath.Join(missingDir, "dashboard-overlay.yaml") failed = putEventTriggers(s, `{"rules":[]}`, version) if failed.Code != http.StatusInternalServerError || !reflect.DeepEqual(cfg.TriggerRulesSnapshot(), before) || strings.Contains(failed.Body.String(), cfg.SourcePath) {