Release URBM 2026.06.15.r009

This commit is contained in:
Mikei386
2026-06-15 07:21:48 +02:00
parent 5e68a50373
commit 772358578e
12 changed files with 78 additions and 16 deletions
+1
View File
@@ -52,6 +52,7 @@ type Job struct {
Schedule Schedule `json:"schedule"`
Consistency Consistency `json:"consistency"`
Compression string `json:"compression"`
CPUCores int `json:"cpuCores,omitempty"`
Excludes []string `json:"excludes,omitempty"`
Tags []string `json:"tags,omitempty"`
FlashImage bool `json:"flashImage,omitempty"`
+3
View File
@@ -127,6 +127,9 @@ func ValidateJob(j Job) error {
if j.Compression != "auto" && j.Compression != "off" && j.Compression != "max" {
return errors.New("compression must be auto, off, or max")
}
if j.CPUCores < 0 || j.CPUCores > 256 {
return errors.New("cpuCores must be between 0 and 256")
}
if j.Consistency.Mode != "live" && j.Consistency.Mode != "stop" {
return errors.New("consistency mode must be live or stop")
}
+12
View File
@@ -79,3 +79,15 @@ func TestRetentionRequiresAtLeastOneRule(t *testing.T) {
t.Fatalf("age retention rejected: %v", err)
}
}
func TestBackupCPUCoresRange(t *testing.T) {
job := Job{SchemaVersion: 1, ID: "job", Name: "Share", Type: JobShare, RepositoryID: "repo", Sources: []Source{{Path: "/mnt/user/data"}}, Consistency: Consistency{Mode: "live"}, Compression: "auto", Retention: Retention{KeepWithinDays: 30}}
job.CPUCores = 2
if err := ValidateJob(job); err != nil {
t.Fatalf("valid CPU limit rejected: %v", err)
}
job.CPUCores = 257
if err := ValidateJob(job); err == nil {
t.Fatal("excessive CPU limit accepted")
}
}