mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-18 05:01:53 +00:00
feat: firecracker best path
This commit is contained in:
parent
74e54d4c36
commit
54a4c423a6
7 changed files with 176 additions and 28 deletions
40
internal/config/config_test.go
Normal file
40
internal/config/config_test.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLoadDiskCloneModeDefaultsToReflink(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if got := loadDiskCloneMode(""); got != DiskCloneModeReflink {
|
||||
t.Fatalf("disk clone mode = %q, want %q", got, DiskCloneModeReflink)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiskCloneModeValidate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
mode DiskCloneMode
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "reflink", mode: DiskCloneModeReflink},
|
||||
{name: "copy", mode: DiskCloneModeCopy},
|
||||
{name: "empty", mode: "", wantErr: true},
|
||||
{name: "unknown", mode: "auto", wantErr: true},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
err := tt.mode.Validate()
|
||||
if tt.wantErr && err == nil {
|
||||
t.Fatal("Validate() error = nil, want error")
|
||||
}
|
||||
if !tt.wantErr && err != nil {
|
||||
t.Fatalf("Validate() error = %v, want nil", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue