Files
fn_registry/functions/infra/audit_ml_env_test.go
T
egutierrez e3c8979e8d chore: auto-commit (95 archivos)
- cmd/fn/doctor.go
- cmd/fn/main.go
- cpp/apps/primitives_gallery/playground/tables/CMakeLists.txt
- cpp/apps/primitives_gallery/playground/tables/data_table.cpp
- cpp/apps/primitives_gallery/playground/tables/data_table_logic.cpp
- cpp/apps/primitives_gallery/playground/tables/data_table_logic.h
- cpp/apps/primitives_gallery/playground/tables/self_test.cpp
- cpp/apps/primitives_gallery/playground/tables/tql.cpp
- cpp/apps/primitives_gallery/playground/tables/viz.cpp
- cpp/apps/primitives_gallery/playground/tables/viz.h
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 00:50:34 +02:00

54 lines
1.4 KiB
Go

package infra
import (
"testing"
)
func TestAuditMlEnv(t *testing.T) {
// Use the actual registry root relative to the test binary location.
// Tests run from the package directory; go up two levels.
registryRoot := "../.."
t.Run("report no nil y tiene checks", func(t *testing.T) {
report, err := AuditMlEnv(registryRoot)
if err != nil {
t.Fatalf("AuditMlEnv returned error: %v", err)
}
if report.Checks == nil {
t.Fatal("report.Checks is nil")
}
})
t.Run("generated_at es positivo", func(t *testing.T) {
report, err := AuditMlEnv(registryRoot)
if err != nil {
t.Fatalf("AuditMlEnv returned error: %v", err)
}
if report.GeneratedAt <= 0 {
t.Errorf("GeneratedAt should be positive unix timestamp, got %d", report.GeneratedAt)
}
})
t.Run("checks tiene al menos 4 entradas", func(t *testing.T) {
report, err := AuditMlEnv(registryRoot)
if err != nil {
t.Fatalf("AuditMlEnv returned error: %v", err)
}
if len(report.Checks) < 4 {
t.Errorf("expected at least 4 checks, got %d", len(report.Checks))
}
})
t.Run("gpus puede ser vacio en CI", func(t *testing.T) {
report, err := AuditMlEnv(registryRoot)
if err != nil {
t.Fatalf("AuditMlEnv returned error: %v", err)
}
// Gpus may be empty in CI without a GPU; that's OK.
// Just verify the field is not nil.
if report.Gpus == nil {
t.Error("report.Gpus should be a non-nil slice (can be empty)")
}
})
}