8000 feat: handle update build for dynamic params by jaaydenh · Pull Request #18226 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: handle update build for dynamic params #18226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: update test calls to match new updateWorkspace signature
The updateWorkspace function now requires additional parameters:
- buildParameters (array, defaults to [])
- isDynamicParametersEnabled (boolean, defaults to false)

Updated all test calls to include these parameters to fix test failures.
  • Loading branch information
blink-so[bot] committed Jun 5, 2025
commit 6a20a0d996432912da932bf88541e255551d451a
6 changes: 3 additions & 3 deletions site/src/api/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe("api.ts", () => {
.spyOn(API, "postWorkspaceBuild")
.mockResolvedValueOnce(MockWorkspaceBuild);
jest.spyOn(API, "getTemplate").mockResolvedValueOnce(MockTemplate);
await API.updateWorkspace(MockWorkspace);
await API.updateWorkspace(MockWorkspace, [], false);
expect(API.postWorkspaceBuild).toHaveBeenCalledWith(MockWorkspace.id, {
transition: "start",
template_version_id: MockTemplate.active_version_id,
Expand All @@ -199,7 +199,7 @@ describe("api.ts", () => {

let error = new Error();
try {
await API.updateWorkspace(MockWorkspace);
await API.updateWorkspace(MockWorkspace, [], false);
} catch (e) {
error = e as Error;
}
Expand All @@ -225,7 +225,7 @@ describe("api.ts", () => {
.mockResolvedValue([
{ ...MockTemplateVersionParameter1, required: true, mutable: false },
]);
await API.updateWorkspace(MockWorkspace);
await API.updateWorkspace(MockWorkspace, [], false);
expect(API.postWorkspaceBuild).toHaveBeenCalledWith(MockWorkspace.id, {
transition: "start",
template_version_id: MockTemplate.active_version_id,
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacePage/WorkspacePage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ describe("WorkspacePage", () => {
name: MockTemplateVersionParameter2.name,
value: "2",
},
]);
], false);
});
});

Expand Down
20 changes: 10 additions & 10 deletions site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ describe("WorkspacesPage", () => {
await waitFor(() => {
expect(updateWorkspace).toHaveBeenCalledTimes(2);
});
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[3]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[3], [], false);
});

it("warns about and updates running workspaces", async () => {
Expand Down Expand Up @@ -160,9 +160,9 @@ describe("WorkspacesPage", () => {
await waitFor(() => {
expect(updateWorkspace).toHaveBeenCalledTimes(3);
});
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[0]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[1]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[0], [], false);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[1], [], false);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
});

it("warns about and ignores dormant workspaces", async () => {
Expand Down Expand Up @@ -199,8 +199,8 @@ describe("WorkspacesPage", () => {
await waitFor(() => {
expect(updateWorkspace).toHaveBeenCalledTimes(2);
});
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[1]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[1], [], false);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
});

it("warns about running workspaces and then dormant workspaces", async () => {
Expand Down Expand Up @@ -241,9 +241,9 @@ describe("WorkspacesPage", () => {
await waitFor(() => {
expect(updateWorkspace).toHaveBeenCalledTimes(3);
});
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[0]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[3]);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[0], [], false);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[2], [], false);
expect(updateWorkspace).toHaveBeenCalledWith(workspaces[3], [], false);
});
});

Expand Down
Loading
0