Files
orchard/internal/imageconstant/imageconstant_test.go
Fedor Kororkov 461af8de47 Migrate CI from Cirrus CI to GitHub Actions (#447)
* Migrate CI to GitHub Actions

* Publish Orchard through the OpenAI Homebrew tap

* Scope release secrets to GoReleaser steps

* Separate release and snapshot trust paths

* Use GitHub-hosted macOS 26 runner

* Run macOS unit tests on hosted runner

* Update Homebrew install command

* Build Docker image with GoReleaser

* Use GitHub-hosted Linux runner

* Use smaller Vetu image for Linux tests

* Run Linux tests on hosted ARM runner

* Use host architecture for Linux integration tests

* Preinstall Cloud Hypervisor for Linux tests

* Select Linux test images by architecture

* Satisfy platform image lint rules

* Format platform image errors

* Enable KVM access for Linux tests

* Honor VM wait time in WebSocket requests

* Satisfy WebSocket client lint rules

* Allow hosted Linux integration tests more time
2026-07-16 17:57:06 -04:00

79 lines
1.8 KiB
Go

package imageconstant_test
import (
"testing"
"github.com/cirruslabs/orchard/internal/imageconstant"
v1 "github.com/cirruslabs/orchard/pkg/resource/v1"
"github.com/stretchr/testify/require"
)
func TestDefaultImage(t *testing.T) {
tests := []struct {
name string
os v1.OS
architecture v1.Architecture
expected string
}{
{
name: "macOS ARM64",
os: v1.OSDarwin,
architecture: v1.ArchitectureARM64,
expected: imageconstant.DefaultMacosImage,
},
{
name: "Linux AMD64",
os: v1.OSLinux,
architecture: v1.ArchitectureAMD64,
expected: imageconstant.DefaultLinuxAMD64Image,
},
{
name: "Linux ARM64",
os: v1.OSLinux,
architecture: v1.ArchitectureARM64,
expected: imageconstant.DefaultLinuxARM64Image,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
actual, err := imageconstant.DefaultImage(test.os, test.architecture)
require.NoError(t, err)
require.Equal(t, test.expected, actual)
})
}
}
func TestDefaultImageRejectsUnsupportedPlatforms(t *testing.T) {
tests := []struct {
name string
os v1.OS
architecture v1.Architecture
}{
{
name: "unsupported OS",
os: v1.OS("windows"),
architecture: v1.ArchitectureAMD64,
},
{
name: "unsupported Linux architecture",
os: v1.OSLinux,
architecture: v1.Architecture("riscv64"),
},
{
name: "unsupported macOS architecture",
os: v1.OSDarwin,
architecture: v1.ArchitectureAMD64,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
_, err := imageconstant.DefaultImage(test.os, test.architecture)
require.Error(t, err)
})
}
}