Files
nasmon/internal/collect/repoiso_test.go
T
a.gritsenkoandClaude Opus 5.5 30dbb00dd1
build / build (push) Successful in 1m43s
Shares of other services and RepoISO integration
- include SMB drop-ins from /etc/samba/smb.conf.d into the generated smb.conf
- keep smbd/nfs-server running while other services (/etc/exports.d, drop-ins) share,
  instead of disabling them when nasmon has no shares of its own
- list those shares read-only on /shares
- settings: RepoISO URL; poll its /api/integration/status, dashboard card, menu link,
  alerts for portal down, stale worker, failed jobs, unmounted publications

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:06:17 +03:00

30 lines
882 B
Go

package collect
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestFetchRepoISO(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/api/integration/status" {
http.NotFound(w, r)
return
}
_, _ = w.Write([]byte(`{"version":"0.1.3","worker_alive":true,"images":5,"images_bytes":1024,"jobs_failed_24h":1}`))
}))
defer srv.Close()
r := FetchRepoISO(srv.URL + "/")
if !r.Reachable || r.Version != "0.1.3" || !r.WorkerAlive || r.Images != 5 || r.JobsFailed24h != 1 || r.URL != srv.URL {
t.Fatalf("unexpected %+v", r)
}
if r := FetchRepoISO(srv.URL + "/missing"); r.Reachable || r.Error != "HTTP 404" {
t.Fatalf("404 not reported: %+v", r)
}
srv.Close()
if r := FetchRepoISO(srv.URL); r.Reachable || r.Error == "" {
t.Fatalf("closed server reported reachable: %+v", r)
}
}