Handle inactive VM and Docker services

This commit is contained in:
Mikei386
2026-06-14 12:53:22 +02:00
parent 800cb60f83
commit 7e2c604c5f
11 changed files with 88 additions and 21 deletions
+26
View File
@@ -0,0 +1,26 @@
package platform
import (
"os"
"path/filepath"
"testing"
)
func TestUnraidServiceEnabled(t *testing.T) {
path := filepath.Join(t.TempDir(), "domain.cfg")
for _, test := range []struct {
content string
want bool
}{
{content: "SERVICE=\"enable\"\n", want: true},
{content: "SERVICE=disable\n", want: false},
{content: "OTHER=value\n", want: false},
} {
if err := os.WriteFile(path, []byte(test.content), 0600); err != nil {
t.Fatal(err)
}
if got := unraidServiceEnabled(path); got != test.want {
t.Fatalf("content %q: got %v, want %v", test.content, got, test.want)
}
}
}