MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / TestValidateCreateConfig

Function TestValidateCreateConfig

cmd/create_test.go:58–237  ·  view source on GitHub ↗

TestValidateCreateConfig provides comprehensive validation testing for instance creation configurations, covering routed 1/2 and 4/8 GPU counts with various GPU types, CPU configurations, and template validations.

(t *testing.T)

Source from the content-addressed store, hash-verified

56// creation configurations, covering routed 1/2 and 4/8 GPU counts with various
57// GPU types, CPU configurations, and template validations.
58func TestValidateCreateConfig(t *testing.T) {
59 tests := []struct {
60 name string
61 config *tui.CreateConfig
62 templates []api.TemplateEntry
63 diskSizeWasSet bool
64 expectError bool
65 errorContains string
66 }{
67 {
68 name: "valid config",
69 config: &tui.CreateConfig{
70 GPUType: "a6000",
71 NumGPUs: 1,
72 VCPUs: 6,
73 Template: "ubuntu-22.04",
74 DiskSizeGB: 100,
75 },
76 templates: []api.TemplateEntry{
77 tmplEntry("ubuntu-22.04", "Ubuntu 22.04"),
78 },
79 expectError: false,
80 },
81 {
82 name: "valid 4 GPU config",
83 config: &tui.CreateConfig{
84 GPUType: "a100",
85 NumGPUs: 4,
86 VCPUs: 60,
87 Template: "pytorch",
88 DiskSizeGB: 500,
89 },
90 templates: []api.TemplateEntry{
91 tmplEntry("pytorch", "PyTorch"),
92 },
93 expectError: false,
94 },
95 {
96 name: "invalid GPU count",
97 config: &tui.CreateConfig{
98 GPUType: "a100",
99 NumGPUs: 3,
100 },
101 expectError: true,
102 errorContains: "GPU count 3 is not valid for a100xl",
103 },
104 {
105 name: "invalid GPU type",
106 config: &tui.CreateConfig{
107 GPUType: "invalid",
108 NumGPUs: 1,
109 },
110 expectError: true,
111 errorContains: "supported GPU types:",
112 },
113 {
114 name: "without vcpus",
115 config: &tui.CreateConfig{

Callers

nothing calls this directly

Calls 4

tmplEntryFunction · 0.85
validateCreateConfigFunction · 0.85
testSpecStoreFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected