Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/yummy-dolls-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Show latest instance by dafault on workflows describe command
36 changes: 31 additions & 5 deletions packages/wrangler/src/__tests__/workflows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ describe("wrangler workflows", () => {
Manage Workflow instances [open-beta]

COMMANDS
wrangler workflows instances list <name> Instance related commands (list, describe, terminate, pause, resume) [open-beta]
wrangler workflows instances describe <name> <id> Describe a workflow instance - see its logs, retries and errors [open-beta]
wrangler workflows instances terminate <name> <id> Terminate a workflow instance [open-beta]
wrangler workflows instances pause <name> <id> Pause a workflow instance [open-beta]
wrangler workflows instances resume <name> <id> Resume a workflow instance [open-beta]
wrangler workflows instances list <name> Instance related commands (list, describe, terminate, pause, resume)
wrangler workflows instances describe <name> [id] Describe a workflow instance - see its logs, retries and errors
wrangler workflows instances terminate <name> <id> Terminate a workflow instance
wrangler workflows instances pause <name> <id> Pause a workflow instance
wrangler workflows instances resume <name> <id> Resume a workflow instance

GLOBAL FLAGS
-c, --config Path to Wrangler configuration file [string]
Expand Down Expand Up @@ -272,6 +272,18 @@ describe("wrangler workflows", () => {
{ once: true }
)
);
http.get(
`*/accounts/:accountId/workflows/some-workflow/instances`,
async () => {
return HttpResponse.json({
success: true,
errors: [],
messages: [],
result: [mockResponse],
});
},
{ once: true }
);
};

it("should describe the bar instance given a name", async () => {
Expand All @@ -284,6 +296,20 @@ describe("wrangler workflows", () => {
│ Start │ End │ Duration │ State │ Error │
├───────────────────────┼───────────────────────┼───────────┼────────────┼────────────────┤
│ 1/1/2021, 12:00:00 AM │ 1/1/2021, 12:00:00 AM │ 0 seconds │ ✅ Success │ string: string │
└───────────────────────┴───────────────────────┴───────────┴────────────┴────────────────┘"
`);
});

it("should describe the latest instance if none is given", async () => {
writeWranglerConfig();
await mockDescribeInstances();

await runWrangler(`workflows instances describe some-workflow bar`);
expect(std.out).toMatchInlineSnapshot(`
"┌───────────────────────┬───────────────────────┬───────────┬────────────┬────────────────┐
│ Start │ End │ Duration │ State │ Error │
├───────────────────────┼───────────────────────┼───────────┼────────────┼────────────────┤
│ 1/1/2021, 12:00:00 AM │ 1/1/2021, 12:00:00 AM │ 0 seconds │ ✅ Success │ string: string │
└───────────────────────┴───────────────────────┴───────────┴────────────┴────────────────┘"
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export const workflowsInstancesDescribeCommand = createCommand({
describe:
"ID of the instance - instead of an UUID you can type 'latest' to get the latest instance and describe it",
type: "string",
demandOption: true,
demandOption: false,
default: "latest",
},
"step-output": {
describe:
Expand Down
Loading