Skip to content

Commit

Permalink
Fix unset deploy parameters (#55)
Browse files Browse the repository at this point in the history
<!--
Thank you for proposing a pull request! Please note that SOME TESTS WILL
LIKELY FAIL due to how GitHub exposes secrets in Pull Requests from
forks.
Someone from the team will review your Pull Request and respond.

Please describe your change and any implementation details below.
-->

Check `--deploy-parameters` object is empty

Fix #54

---------

Co-authored-by: henrybell <[email protected]>
  • Loading branch information
lukebarge and henrybell authored Mar 26, 2024
1 parent fd4cd11 commit f41de37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export async function run(): Promise<void> {
if (skaffoldFile) {
cmd.push('--skaffold-file', skaffoldFile);
}
if (deployParameters) {
if (deployParameters && Object.keys(deployParameters).length > 0) {
cmd.push('--deploy-parameters', joinKVString(deployParameters));
}

Expand Down
10 changes: 10 additions & 0 deletions tests/unit/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit f41de37

Please sign in to comment.