From f8ebdd1b2ba7cdc30a17c19dc66aed064213b2a6 Mon Sep 17 00:00:00 2001 From: Nafeez Date: Thu, 31 Oct 2024 04:35:01 -0700 Subject: [PATCH] fix: Modify Cloudchamber deployment labels in interactive mode (#7124) 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. --- .changeset/odd-lions-warn.md | 5 +++++ packages/wrangler/src/__tests__/cloudchamber/modify.test.ts | 6 +++--- packages/wrangler/src/cloudchamber/modify.ts | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/odd-lions-warn.md diff --git a/.changeset/odd-lions-warn.md b/.changeset/odd-lions-warn.md new file mode 100644 index 000000000000..1b2b0f3732cb --- /dev/null +++ b/.changeset/odd-lions-warn.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +fix: Modify Cloudchamber deployment labels in interactive mode diff --git a/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts b/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts index ab12fbbfe94c..b6d5a59f14ba 100644 --- a/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts +++ b/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts @@ -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]); }, @@ -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 @@ -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); diff --git a/packages/wrangler/src/cloudchamber/modify.ts b/packages/wrangler/src/cloudchamber/modify.ts index 91fb42686875..4c02b1579a52 100644 --- a/packages/wrangler/src/cloudchamber/modify.ts +++ b/packages/wrangler/src/cloudchamber/modify.ts @@ -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, })