From 185e29bfca40dcd2c488f85e67a0030403fabb61 Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 14 Nov 2024 12:39:56 -0500 Subject: [PATCH] add a comment and an integration test to enable droplet backups with backup policy --- commands/droplet_actions.go | 1 + integration/compute_droplet_action_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/commands/droplet_actions.go b/commands/droplet_actions.go index 262528a61..902082421 100644 --- a/commands/droplet_actions.go +++ b/commands/droplet_actions.go @@ -298,6 +298,7 @@ func readDropletBackupPolicy(c *CmdConfig) (*godo.DropletBackupPolicyRequest, er return nil, err } + // For cases when backup policy is not specified. if policyPlan == "" { return nil, nil } diff --git a/integration/compute_droplet_action_test.go b/integration/compute_droplet_action_test.go index b9f54c9c1..bf1a7f91d 100644 --- a/integration/compute_droplet_action_test.go +++ b/integration/compute_droplet_action_test.go @@ -48,6 +48,7 @@ var _ = suite("compute/droplet-action", func(t *testing.T, when spec.G, it spec. "/v2/droplets/4743/actions": {method: http.MethodPost, body: `{"image":9999,"type":"rebuild"}`}, "/v2/droplets/884/actions": {method: http.MethodPost, body: `{"disk":true,"size":"bigger","type":"resize"}`}, "/v2/droplets/789/actions/954": {method: http.MethodGet, body: `{}`}, + "/v2/droplets/66/actions": {method: http.MethodPost, body: `{"type":"enable_backups","backup_policy":{"plan":"weekly","weekday":"TUE","hour":16}}`}, } auth := req.Header.Get("Authorization") @@ -110,6 +111,7 @@ var _ = suite("compute/droplet-action", func(t *testing.T, when spec.G, it spec. {desc: "snapshot", args: []string{"snapshot", "48", "--snapshot-name", "best-snapshot"}}, {desc: "get", args: []string{"get", "789", "--action-id", "954"}}, {desc: "g", args: []string{"get", "789", "--action-id", "954"}}, + {desc: "enable backups with policy", args: []string{"enable-backups", "66", "--backup-policy-plan", "weekly", "--backup-policy-weekday", "TUE", "--backup-policy-hour", "16"}}, } for _, c := range cases {