MCPcopy
hub / github.com/digitalocean/doctl / TestRunDedicatedInferenceUpdate

Function TestRunDedicatedInferenceUpdate

commands/dedicated_inference_test.go:197–233  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

195}
196
197func TestRunDedicatedInferenceUpdate(t *testing.T) {
198 withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
199 specJSON := `{
200 "version": 0,
201 "name": "test-dedicated-inference",
202 "region": "nyc2",
203 "vpc": {"uuid": "00000000-0000-4000-8000-000000000001"},
204 "enable_public_endpoint": true,
205 "model_deployments": [
206 {
207 "model_slug": "mistral/mistral-7b-instruct-v3",
208 "provider_model_id": "mistralai/Mistral-7B-Instruct-v0.3",
209 "model_provider": "hugging_face",
210 "accelerators": [
211 {"scale": 2, "type": "prefill", "accelerator_slug": "gpu-mi300x1-192gb"},
212 {"scale": 4, "type": "decode", "accelerator_slug": "gpu-mi300x1-192gb"}
213 ]
214 }
215 ]
216 }`
217 tmpFile := t.TempDir() + "/spec.json"
218 err := os.WriteFile(tmpFile, []byte(specJSON), 0644)
219 assert.NoError(t, err)
220
221 config.Doit.Set(config.NS, doctl.ArgDedicatedInferenceSpec, tmpFile)
222 config.Args = append(config.Args, "00000000-0000-4000-8000-000000000000")
223
224 expectedReq := &godo.DedicatedInferenceUpdateRequest{
225 Spec: testDedicatedInferenceSpecRequest,
226 }
227
228 tm.dedicatedInferences.EXPECT().Update("00000000-0000-4000-8000-000000000000", expectedReq).Return(&testDedicatedInference, nil)
229
230 err = RunDedicatedInferenceUpdate(config)
231 assert.NoError(t, err)
232 })
233}
234
235func TestRunDedicatedInferenceUpdate_WithHuggingFaceToken(t *testing.T) {
236 withTestClient(t, func(config *CmdConfig, tm *tcMocks) {

Callers

nothing calls this directly

Calls 5

withTestClientFunction · 0.85
SetMethod · 0.65
UpdateMethod · 0.65
EXPECTMethod · 0.45

Tested by

no test coverage detected