feat(storage): add root volume expansion
test / go (push) Successful in 4m59s

This commit is contained in:
shiran
2026-09-01 15:02:21 +08:00
parent 4f7f1f0fba
commit 06b11d8121
4 changed files with 32 additions and 7 deletions
+17
View File
@@ -190,6 +190,23 @@ func TestInstanceChangePricingAndAsyncTraffic(t *testing.T) {
}
}
func TestExpandRootVolumePathAndBody(t *testing.T) {
client, _ := testClient(t, func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPatch || r.URL.Path != "/api/sdk/v1/regions/us-east-1/instances/local-1/root-volume" {
t.Fatalf("unexpected request %s %s", r.Method, r.URL.Path)
}
var body ExpandRootVolumeRequest
if err := json.NewDecoder(r.Body).Decode(&body); err != nil || body.SizeGiB != 80 || body.ExpectedConfigurationFingerprint != "fp" {
t.Fatalf("unexpected body %#v err=%v", body, err)
}
_, _ = w.Write([]byte(`{"code":202,"message":"Accepted","data":{"task_id":"task-root","status":"queued"}}`))
})
operation, err := client.Volumes.ExpandRoot(context.Background(), "us-east-1", "local-1", ExpandRootVolumeRequest{SizeGiB: 80, ExpectedConfigurationFingerprint: "fp"}, WithIdempotencyKey("root-expand"))
if err != nil || operation.TaskID != "task-root" {
t.Fatalf("operation=%#v err=%v", operation, err)
}
}
func TestInstanceDetailsExposeCatalogMetadata(t *testing.T) {
client, _ := testClient(t, func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")