Publish ITWorx Pulse source
Public source validation / validate (push) Failing after 3m8s

This commit is contained in:
ITWorx Pulse release export
2026-09-03 02:09:19 +02:00
commit bd774932d5
614 changed files with 77116 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package unraid
import (
"context"
"net/http"
"net/http/httptest"
"testing"
"time"
)
func TestShareSourcePreservesReadOnlyUsageAndPolicy(t *testing.T) {
server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(`{"data":{"shares":[{"id":"share-1","name":"appdata","used":"64","size":"128","include":["disk1"],"exclude":[],"cache":true,"allocator":"high-water"}]}}`))
}))
defer server.Close()
client, err := New(server.URL, "test-token", server.Client())
if err != nil {
t.Fatal(err)
}
now := time.Date(2026, 8, 10, 4, 0, 0, 0, time.UTC)
snapshot, err := (ShareSource{Client: client, Now: func() time.Time { return now }}).Snapshot(context.Background())
if err != nil {
t.Fatal(err)
}
if len(snapshot.Shares) != 1 {
t.Fatalf("shares = %+v", snapshot.Shares)
}
item := snapshot.Shares[0]
if item.UsedBytes != 64*1024 || item.SizeState != "available" || item.StoragePolicy.CachePolicy != "enabled" || item.StoragePolicy.Allocation != "high-water" {
t.Fatalf("share mapping = %+v", item)
}
}