0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00
terraform-provider-proxmox/proxmoxtf/resource/validators/cpu_test.go
Pavel Boldyrev 9c72e584de
fix(vm): do not overwrite cpu attributes with defaults when cloning
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-04-15 23:04:53 -04:00

39 lines
642 B
Go

package validators
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestCPUType(t *testing.T) {
t.Parallel()
tests := []struct {
name string
value string
valid bool
}{
{"empty", "", false},
{"invalid", "invalid", false},
{"valid", "host", true},
{"valid", "qemu64", true},
{"valid", "custom-abc", true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
f := CPUTypeValidator()
res := f(tt.value, nil)
if tt.valid {
require.Empty(t, res, "validate: '%s'", tt.value)
} else {
require.NotEmpty(t, res, "validate: '%s'", tt.value)
}
})
}
}