Skip to content

Commit

Permalink
add a comment and an integration test to enable droplet backups with …
Browse files Browse the repository at this point in the history
…backup policy
  • Loading branch information
loosla committed Nov 14, 2024
1 parent d5a31a5 commit 185e29b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions commands/droplet_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions integration/compute_droplet_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 185e29b

Please sign in to comment.