Skip to content

Commit 59e0739

Browse files
committed
feat(MARSOHS-1935): list DELETING as a workspace state in the help text
The API has a sixth workspace state, DELETING, shown while a delete runs, and accepts it as the --state filter. List it in the flag and the list help, say that a create retried with the key of a workspace being deleted is refused with a conflict, and that a workspace shows DELETING while its delete runs.
1 parent 9f63146 commit 59e0739

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎commands/agent_workspaces.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func AgentWorkspaces() *Command {
5858
agentsWorkspaceListHelpMD,
5959
Writer, agentPrettyErrors(), aliasOpt("ls"),
6060
displayerType(&displayers.HostedAgentWorkspace{}))
61-
AddStringFlag(cmdList, doctl.ArgAgentWorkspaceState, "", "", "Only list workspaces in this state: AVAILABLE, ATTACHING, ATTACHED, RELEASING or FAILED")
61+
AddStringFlag(cmdList, doctl.ArgAgentWorkspaceState, "", "", "Only list workspaces in this state: AVAILABLE, ATTACHING, ATTACHED, RELEASING, FAILED or DELETING")
6262
AddIntFlag(cmdList, doctl.ArgAgentPageSize, "", 0, "Maximum number of workspaces to return per page")
6363
AddStringFlag(cmdList, doctl.ArgAgentPageToken, "", "", "Pagination cursor from a previous list response")
6464
cmdList.Example = `doctl harness-runtime workspace list --page-size 10; doctl harness-runtime workspace list --state AVAILABLE`

‎commands/agent_workspaces_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func TestRunAgentsWorkspaceList_StateIsLeftToTheServer(t *testing.T) {
246246
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
247247
tm.hostedAgents.EXPECT().
248248
ListWorkspaces(&godo.HostedAgentWorkspaceListOptions{State: "busy"}).
249-
Return(nil, "", godoStatusErr(http.StatusBadRequest, "state must be one of AVAILABLE, ATTACHING, ATTACHED, RELEASING, FAILED"))
249+
Return(nil, "", godoStatusErr(http.StatusBadRequest, "state must be one of AVAILABLE, ATTACHING, ATTACHED, RELEASING, FAILED, DELETING"))
250250

251251
config.Out = &bytes.Buffer{}
252252
config.Doit.Set(config.NS, doctl.ArgAgentWorkspaceState, "busy")
@@ -285,7 +285,7 @@ func TestAgentWorkspaceListFlags(t *testing.T) {
285285
assert.NotNil(t, list.Flags().Lookup(name), "workspace list needs --%s", name)
286286
}
287287
assert.Equal(t, "state", doctl.ArgAgentWorkspaceState)
288-
for _, state := range []string{"AVAILABLE", "ATTACHING", "ATTACHED", "RELEASING", "FAILED"} {
288+
for _, state := range []string{"AVAILABLE", "ATTACHING", "ATTACHED", "RELEASING", "FAILED", "DELETING"} {
289289
assert.Contains(t, agentsWorkspaceListHelpMD, state)
290290
}
291291
}

‎commands/agents_help.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,17 @@ Create one, then give it to a new session with ` + "`--workspace <id>`" + ` on `
321321

322322
const agentsWorkspaceCreateHelpMD = `Create a persistent workspace. ` + "`--size-gib`" + ` is required: a whole number from 1 to 100, and your team's limit may be lower. The size cannot be changed later. ` + "`--name`" + ` is an optional label and is not unique.
323323
324-
**Safe to retry.** Each run sends one idempotency key, so a request that doctl repeats within the run cannot create a second workspace. doctl makes up a key unless you pass ` + "`--idempotency-key`" + `. A script that re-runs the whole command must pass its own key: without one, every run is a new workspace. Within 24 hours the same key with the same size and name returns the first workspace; the same key with different values is rejected.`
324+
**Safe to retry.** Each run sends one idempotency key, so a request that doctl repeats within the run cannot create a second workspace. doctl makes up a key unless you pass ` + "`--idempotency-key`" + `. A script that re-runs the whole command must pass its own key: without one, every run is a new workspace. Within 24 hours the same key with the same size and name returns the first workspace; the same key with different values is rejected. If the workspace that key created is being deleted, the retry is refused with a conflict; try again in a moment and the key then creates a new workspace.`
325325

326-
const agentsWorkspaceListHelpMD = `List persistent workspaces, newest first. Show only one state with ` + "`--state`" + ` (AVAILABLE, ATTACHING, ATTACHED, RELEASING or FAILED); use ` + "`--state AVAILABLE`" + ` to see the workspaces a new session can use. Paginate with ` + "`--page-size`" + ` and ` + "`--page-token`" + `.
326+
const agentsWorkspaceListHelpMD = `List persistent workspaces, newest first. Show only one state with ` + "`--state`" + ` (AVAILABLE, ATTACHING, ATTACHED, RELEASING, FAILED or DELETING); use ` + "`--state AVAILABLE`" + ` to see the workspaces a new session can use. Paginate with ` + "`--page-size`" + ` and ` + "`--page-token`" + `.
327327
328328
A page can hold fewer workspaces than ` + "`--page-size`" + `, even none, while a next page token is printed. Keep listing with that token until none is printed.`
329329

330330
const agentsWorkspaceGetHelpMD = `Print details for one persistent workspace: its state, size, how much is used, the session that holds it, and when it was last saved.`
331331

332332
const agentsWorkspaceDeleteHelpMD = `Permanently delete a persistent workspace and everything saved in it. This cannot be undone. Asks for confirmation unless ` + "`--force`" + ` is given.
333333
334-
A workspace a session still holds cannot be deleted: remove the session, wait until the workspace is available again, then delete it. Removing a session never deletes its workspace.`
334+
A workspace a session still holds cannot be deleted: remove the session, wait until the workspace is available again, then delete it. Removing a session never deletes its workspace. A workspace shows DELETING while its delete runs; once it finishes, the workspace no longer exists.`
335335

336336
const agentsTriggersRootHelpMD = `Webhook and cron triggers that start agent runs on external events or a schedule.
337337

0 commit comments

Comments
 (0)
⌂ 换网址