From ceb03ba1c4e87faeb77caba4a394ac8510519fdd Mon Sep 17 00:00:00 2001 From: Cori Avila <42420333+corico44@users.noreply.github.com> Date: Mon, 15 May 2023 16:29:28 +0200 Subject: [PATCH] [bitnami/alertmanager] Add VIB tests (#30856) * [bitnami/alertmanager] Add initial tests Signed-off-by: Cori Avila * [bitnami/alertmanager] Add change in docker-compose file to trigger tests Signed-off-by: Cori Avila * [bitnami/alertmanager] Modify order of items in goss.yaml file Signed-off-by: corico44 <42420333+corico44@users.noreply.github.com> * [bitnami/alertmanager] Delete blank space Signed-off-by: corico44 <42420333+corico44@users.noreply.github.com> * [bitnami/alertmanager] Fix check-app-version test Signed-off-by: corico44 <42420333+corico44@users.noreply.github.com> * [bitnami/alertmanager] Delete test for secondary binary and modify check-version test Signed-off-by: Cori Avila * [bitnami/alertmanager] Delete check for directories and add check app run test Signed-off-by: Cori Avila * [bitnami/alertmanager] Delete files check test Signed-off-by: Cori Avila * [bitnami/alertmanager] Delete trigger in docker-compose file Signed-off-by: Cori Avila <42420333+corico44@users.noreply.github.com> --------- Signed-off-by: Cori Avila Signed-off-by: corico44 <42420333+corico44@users.noreply.github.com> Signed-off-by: Cori Avila <42420333+corico44@users.noreply.github.com> --- .vib/alertmanager/goss/alertmanager.yaml | 4 ++++ .vib/alertmanager/goss/goss.yaml | 11 +++++++++++ .vib/alertmanager/goss/vars.yaml | 7 +++++++ .vib/alertmanager/vib-publish.json | 18 +++++++++++++++++- .vib/alertmanager/vib-verify.json | 18 +++++++++++++++++- 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .vib/alertmanager/goss/alertmanager.yaml create mode 100644 .vib/alertmanager/goss/goss.yaml create mode 100644 .vib/alertmanager/goss/vars.yaml diff --git a/.vib/alertmanager/goss/alertmanager.yaml b/.vib/alertmanager/goss/alertmanager.yaml new file mode 100644 index 000000000000..c3a7b7d95c82 --- /dev/null +++ b/.vib/alertmanager/goss/alertmanager.yaml @@ -0,0 +1,4 @@ +command: + check-app-run: + exec: timeout --preserve-status 5 /opt/bitnami/alertmanager/bin/alertmanager --config.file=/opt/bitnami/alertmanager/conf/config.yml --storage.path=/opt/bitnami/alertmanager/data + exit-status: 0 \ No newline at end of file diff --git a/.vib/alertmanager/goss/goss.yaml b/.vib/alertmanager/goss/goss.yaml new file mode 100644 index 000000000000..8398dfd62ccb --- /dev/null +++ b/.vib/alertmanager/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../alertmanager/goss/alertmanager.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-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} + ../../common/goss/templates/check-spdx.yaml: {} diff --git a/.vib/alertmanager/goss/vars.yaml b/.vib/alertmanager/goss/vars.yaml new file mode 100644 index 000000000000..782be928a6b4 --- /dev/null +++ b/.vib/alertmanager/goss/vars.yaml @@ -0,0 +1,7 @@ +binaries: + - alertmanager + - amtool +version: + bin_name: alertmanager + flag: --version +root_dir: /opt/bitnami diff --git a/.vib/alertmanager/vib-publish.json b/.vib/alertmanager/vib-publish.json index 8b6fe8eab4e6..9d876f002668 100644 --- a/.vib/alertmanager/vib-publish.json +++ b/.vib/alertmanager/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": "alertmanager/goss/goss.yaml", + "vars_file": "alertmanager/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-alertmanager" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/alertmanager/vib-verify.json b/.vib/alertmanager/vib-verify.json index a34e8aee9161..087fd2401e84 100644 --- a/.vib/alertmanager/vib-verify.json +++ b/.vib/alertmanager/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": "alertmanager/goss/goss.yaml", + "vars_file": "alertmanager/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-alertmanager" + } + } + } + }, { "action_id": "trivy", "params": {