go-container/sources/source_test.go
Snider 8bc93ce610 feat: extract container/, devops/, sources/ from go-devops
Container runtime (LinuxKit, hypervisor, state, templates), dev
environment management (renamed devops → devenv), and image sources
(CDN, GitHub). 254 tests passing. Package devops renamed to devenv
to avoid collision with parent repo name.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 11:42:51 +00:00

35 lines
941 B
Go

package sources
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSourceConfig_Empty(t *testing.T) {
cfg := SourceConfig{}
assert.Empty(t, cfg.GitHubRepo)
assert.Empty(t, cfg.RegistryImage)
assert.Empty(t, cfg.CDNURL)
assert.Empty(t, cfg.ImageName)
}
func TestSourceConfig_Complete(t *testing.T) {
cfg := SourceConfig{
GitHubRepo: "owner/repo",
RegistryImage: "ghcr.io/owner/image:v1",
CDNURL: "https://cdn.example.com/images",
ImageName: "my-image-darwin-arm64.qcow2",
}
assert.Equal(t, "owner/repo", cfg.GitHubRepo)
assert.Equal(t, "ghcr.io/owner/image:v1", cfg.RegistryImage)
assert.Equal(t, "https://cdn.example.com/images", cfg.CDNURL)
assert.Equal(t, "my-image-darwin-arm64.qcow2", cfg.ImageName)
}
func TestImageSource_Interface(t *testing.T) {
// Ensure both sources implement the interface
var _ ImageSource = (*GitHubSource)(nil)
var _ ImageSource = (*CDNSource)(nil)
}