From 3d7d8f56aac9751ff920d96cea946e04d9968ec5 Mon Sep 17 00:00:00 2001 From: Michiel Date: Wed, 8 Mar 2023 17:15:10 +0100 Subject: [PATCH] [bitnami/node] Add verification tests for NodeJS container (#26064) * [bitnami/node] Add verification tests for NodeJS container Signed-off-by: Michiel --- .vib/node/goss/goss.yaml | 11 +++++++++++ .vib/node/goss/node.yaml | 14 ++++++++++++++ .vib/node/goss/vars.yaml | 19 +++++++++++++++++++ .vib/node/vib-publish.json | 20 ++++++++++++++++++-- .vib/node/vib-verify.json | 18 +++++++++++++++++- 5 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 .vib/node/goss/goss.yaml create mode 100644 .vib/node/goss/node.yaml create mode 100644 .vib/node/goss/vars.yaml diff --git a/.vib/node/goss/goss.yaml b/.vib/node/goss/goss.yaml new file mode 100644 index 000000000000..d08582fc2287 --- /dev/null +++ b/.vib/node/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../node/goss/node.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-app-version.yaml: {} + ../../common/goss/templates/check-binaries.yaml: {} + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-ca-certs.yaml: {} + ../../common/goss/templates/check-directories.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} \ No newline at end of file diff --git a/.vib/node/goss/node.yaml b/.vib/node/goss/node.yaml new file mode 100644 index 000000000000..e35ff4ae801a --- /dev/null +++ b/.vib/node/goss/node.yaml @@ -0,0 +1,14 @@ +command: + # Node can run a simple 'Hello World' program + check-node: + exec: "node -e \"console.log('Hello World')\"" + exit-status: 0 + stdout: + - Hello World + check-global-modules: + exec: npm list -g + exit-status: 0 + stdout: + {{ range $module := .Vars.modules }} + - {{ $module }} + {{ end }} \ No newline at end of file diff --git a/.vib/node/goss/vars.yaml b/.vib/node/goss/vars.yaml new file mode 100644 index 000000000000..c1d5eb232edf --- /dev/null +++ b/.vib/node/goss/vars.yaml @@ -0,0 +1,19 @@ +binaries: + - node + - npm + - npx + - node-gyp + - python + - yarn +directories: + - mode: "0755" + paths: + - /app +root_dir: /opt/bitnami +modules: + - node-gyp + - npm + - yarn +version: + bin_name: node + flag: --version \ No newline at end of file diff --git a/.vib/node/vib-publish.json b/.vib/node/vib-publish.json index f58738648055..f2b0dab147f2 100644 --- a/.vib/node/vib-publish.json +++ b/.vib/node/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -33,6 +34,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "node/goss/goss.yaml", + "vars_file": "node/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-node" + } + } + } + }, { "action_id": "trivy", "params": { @@ -91,4 +107,4 @@ ] } } -} +} \ No newline at end of file diff --git a/.vib/node/vib-verify.json b/.vib/node/vib-verify.json index 835cd556e241..6542c40d6cd7 100644 --- a/.vib/node/vib-verify.json +++ b/.vib/node/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -29,6 +30,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "node/goss/goss.yaml", + "vars_file": "node/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-node" + } + } + } + }, { "action_id": "trivy", "params": {