cli/pkg/devops/images_test.go
Snider cd7930af2a feat(devops): add ImageManager
Manages image downloads, manifest tracking, and update checking.
Tries sources in priority order (GitHub, CDN).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 02:10:16 +00:00

32 lines
609 B
Go

package devops
import (
"os"
"path/filepath"
"testing"
)
func TestImageManager_Good_IsInstalled(t *testing.T) {
tmpDir := t.TempDir()
t.Setenv("CORE_IMAGES_DIR", tmpDir)
cfg := DefaultConfig()
mgr, err := NewImageManager(cfg)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
// Not installed yet
if mgr.IsInstalled() {
t.Error("expected IsInstalled() to be false")
}
// Create fake image
imagePath := filepath.Join(tmpDir, ImageName())
os.WriteFile(imagePath, []byte("fake"), 0644)
// Now installed
if !mgr.IsInstalled() {
t.Error("expected IsInstalled() to be true")
}
}