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

Function TestBuildModifyRequestFromConfig

cmd/modify_test.go:264–401  ·  view source on GitHub ↗

── buildModifyRequestFromConfig ────────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

262// ── buildModifyRequestFromConfig ────────────────────────────────────────────
263
264func TestBuildModifyRequestFromConfig(t *testing.T) {
265 tests := []struct {
266 name string
267 config *tui.ModifyConfig
268 instance *api.Instance
269 expectError bool
270 errorContains string
271 validate func(t *testing.T, req api.InstanceModifyRequest)
272 }{
273 {
274 name: "GPU change only",
275 config: &tui.ModifyConfig{
276 GPUType: "h100",
277 GPUChanged: true,
278 },
279 instance: modifyInstance("prototyping", "a6000", "1", "8", 100),
280 validate: func(t *testing.T, req api.InstanceModifyRequest) {
281 require.NotNil(t, req.GPUType)
282 assert.Equal(t, "h100", *req.GPUType)
283 },
284 },
285 {
286 name: "compute change sets vcpus",
287 config: &tui.ModifyConfig{
288 VCPUs: 12,
289 ComputeChanged: true,
290 },
291 instance: modifyInstance("prototyping", "a6000", "1", "8", 100),
292 validate: func(t *testing.T, req api.InstanceModifyRequest) {
293 require.NotNil(t, req.CPUCores)
294 assert.Equal(t, 12, *req.CPUCores)
295 assert.Nil(t, req.NumGPUs)
296 },
297 },
298 {
299 name: "compute change sets num-gpus",
300 config: &tui.ModifyConfig{
301 NumGPUs: 4,
302 VCPUs: 8,
303 ComputeChanged: true,
304 },
305 instance: modifyInstance("prototyping", "a6000", "1", "8", 100),
306 validate: func(t *testing.T, req api.InstanceModifyRequest) {
307 require.NotNil(t, req.NumGPUs)
308 assert.Equal(t, 4, *req.NumGPUs)
309 assert.Nil(t, req.CPUCores)
310 },
311 },
312 {
313 name: "compute change sets num-gpus and vcpus",
314 config: &tui.ModifyConfig{
315 NumGPUs: 4,
316 VCPUs: 16,
317 ComputeChanged: true,
318 },
319 instance: modifyInstance("prototyping", "a6000", "1", "8", 100),
320 validate: func(t *testing.T, req api.InstanceModifyRequest) {
321 require.NotNil(t, req.NumGPUs)

Callers

nothing calls this directly

Calls 3

modifyInstanceFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected