From e43e4328483308c9b31464e649e583e5557a207d Mon Sep 17 00:00:00 2001 From: aneta-ii <70603249+aneta-ii@users.noreply.github.com> Date: Fri, 26 Feb 2021 17:29:15 +0200 Subject: [PATCH] Add testCmd It was not possible to execute helm test by using task: test, because of hardcoded arguments which all tasks with value different from task: remove receive. I added command testCmd, in order to be able to execute helm tests. --- index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e49304e6..bf0324e0 100644 --- a/index.js +++ b/index.js @@ -145,6 +145,17 @@ function deleteCmd(helm, namespace, release) { return ["delete", "--purge", release]; } +/** + * Makes a test command + * + * @param {string} helm + * @param {string} namespace + * @param {string} release + */ +function testCmd(helm, namespace, release) { + return ["test", "-n", namespace, release, "--logs"]; +} + /** * Run executes the helm deployment. */ @@ -196,6 +207,7 @@ async function run() { chart, "--install", "--wait", + "--create-namespace", `--namespace=${namespace}`, ]; @@ -257,7 +269,10 @@ async function run() { await exec.exec(helm, deleteCmd(helm, namespace, release), { ignoreReturnCode: true }); - } else { + } else if (task === "test") { + await exec.exec(helm, testCmd(helm, namespace, release), { + }); + }else { await exec.exec(helm, args); }