Skip to content

Commit

Permalink
fix: Modify Cloudchamber deployment labels in interactive mode (#7124)
Browse files Browse the repository at this point in the history
Depolyment label modification works as expected in non-interactive mode. However,
during interactive mode, we do not add the required labels to the final API Request.

Added labels fixture to modification tests as well.
  • Loading branch information
skepticfx authored Oct 31, 2024
1 parent 2e43346 commit f8ebdd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-lions-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: Modify Cloudchamber deployment labels in interactive mode
6 changes: 3 additions & 3 deletions packages/wrangler/src/__tests__/cloudchamber/modify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function mockDeployment() {
"*/deployments/1234/v2",
async ({ request }) => {
expect(await request.text()).toBe(
`{"image":"hello:modify","location":"sfo06","environment_variables":[{"name":"HELLO","value":"WORLD"},{"name":"YOU","value":"CONQUERED"}],"vcpu":3,"memory":"40MB"}`
`{"image":"hello:modify","location":"sfo06","environment_variables":[{"name":"HELLO","value":"WORLD"},{"name":"YOU","value":"CONQUERED"}],"labels":[{"name":"appname","value":"helloworld"},{"name":"region","value":"wnam"}],"vcpu":3,"memory":"40MB"}`
);
return HttpResponse.json(MOCK_DEPLOYMENTS_COMPLEX[0]);
},
Expand Down Expand Up @@ -94,7 +94,7 @@ describe("cloudchamber modify", () => {
setWranglerConfig({});
mockDeployment();
await runWrangler(
"cloudchamber modify 1234 --image hello:modify --location sfo06 --var HELLO:WORLD --var YOU:CONQUERED --vcpu 3 --memory 40MB"
"cloudchamber modify 1234 --image hello:modify --location sfo06 --var HELLO:WORLD --var YOU:CONQUERED --label appname:helloworld --label region:wnam --vcpu 3 --memory 40MB"
);
expect(std.err).toMatchInlineSnapshot(`""`);
// so testing the actual UI will be harder than expected
Expand All @@ -112,7 +112,7 @@ describe("cloudchamber modify", () => {
});
mockDeployment();
await runWrangler(
"cloudchamber modify 1234 --var HELLO:WORLD --var YOU:CONQUERED"
"cloudchamber modify 1234 --var HELLO:WORLD --var YOU:CONQUERED --label appname:helloworld --label region:wnam"
);
expect(std.err).toMatchInlineSnapshot(`""`);
expect(std.out).toMatchInlineSnapshot(EXPECTED_RESULT);
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/cloudchamber/modify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ async function handleModifyCommand(
location,
ssh_public_key_ids: keys,
environment_variables: selectedEnvironmentVariables,
labels: selectedLabels,
vcpu: args.vcpu ?? config.cloudchamber.vcpu,
memory: args.memory ?? config.cloudchamber.memory,
})
Expand Down

0 comments on commit f8ebdd1

Please sign in to comment.