From d8273ca82ea55404df66c9842b89579b51693349 Mon Sep 17 00:00:00 2001 From: Luke Barge Date: Tue, 26 Mar 2024 10:00:03 +0000 Subject: [PATCH 1/3] Fixed unset deploy paramaters --- src/main.ts | 2 +- tests/unit/main.test.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index e7368ca..ed6e617 100644 --- a/src/main.ts +++ b/src/main.ts @@ -147,7 +147,7 @@ export async function run(): Promise { if (skaffoldFile) { cmd.push('--skaffold-file', skaffoldFile); } - if (deployParameters) { + if (!(Object.keys(deployParameters).length === 0)) { cmd.push('--deploy-parameters', joinKVString(deployParameters)); } diff --git a/tests/unit/main.test.ts b/tests/unit/main.test.ts index 3cdeea7..7acc503 100644 --- a/tests/unit/main.test.ts +++ b/tests/unit/main.test.ts @@ -362,6 +362,16 @@ test('#run', { concurrency: true }, async (suite) => { ]); }); + await suite.test('does not set deploy parameters if not given', async (t) => { + const mocks = defaultMocks(t.mock); + + await run(); + + const execArguments = mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1); + assert(execArguments); + assert(!execArguments?.includes('--deploy-parameters')); +}); + await suite.test('sets flags if given', async (t) => { const mocks = defaultMocks(t.mock, { flags: '--flag1=value1 --flag2=value2', From 6d8f2faec75fc1b21b42c446549715ac622c2e02 Mon Sep 17 00:00:00 2001 From: henrybell Date: Tue, 26 Mar 2024 17:04:05 +0000 Subject: [PATCH 2/3] Maintain consistency with other parameters --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index ed6e617..65792da 100644 --- a/src/main.ts +++ b/src/main.ts @@ -147,7 +147,7 @@ export async function run(): Promise { if (skaffoldFile) { cmd.push('--skaffold-file', skaffoldFile); } - if (!(Object.keys(deployParameters).length === 0)) { + if (deployParameters && Object.keys(deployParameters).length > 0) { cmd.push('--deploy-parameters', joinKVString(deployParameters)); } From 4e999f8d0c819415a5d9561db5300f596fc6f311 Mon Sep 17 00:00:00 2001 From: henrybell Date: Tue, 26 Mar 2024 17:04:35 +0000 Subject: [PATCH 3/3] Whitespace/formatting --- tests/unit/main.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/main.test.ts b/tests/unit/main.test.ts index 7acc503..2240e28 100644 --- a/tests/unit/main.test.ts +++ b/tests/unit/main.test.ts @@ -366,11 +366,11 @@ test('#run', { concurrency: true }, async (suite) => { const mocks = defaultMocks(t.mock); await run(); - + const execArguments = mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1); assert(execArguments); assert(!execArguments?.includes('--deploy-parameters')); -}); + }); await suite.test('sets flags if given', async (t) => { const mocks = defaultMocks(t.mock, {