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.

Isolate internal/api tests from system data dir

rcourtman27367da17fdc
diff --git a/internal/api/main_test.go b/internal/api/main_test.go
index caea54ef56..55e1e9330a 100644
--- a/internal/api/main_test.go
+++ b/internal/api/main_test.go
@@ -11,9 +11,16 @@ import (
)
func TestMain(m *testing.M) {
+ dataDir, err := os.MkdirTemp("", "pulse-internal-api-test-*")
+ if err != nil {
+ panic(err)
+ }
_ = os.Setenv("PULSE_TEST_BCRYPT_COST", strconv.Itoa(bcrypt.MinCost))
_ = os.Setenv("PULSE_UPDATE_SERVER", "http://127.0.0.1:1")
+ _ = os.Setenv("PULSE_DATA_DIR", dataDir)
allowLoopbackSSOFetch = true
log.Logger = zerolog.Nop()
- os.Exit(m.Run())
+ code := m.Run()
+ _ = os.RemoveAll(dataDir)
+ os.Exit(code)
}