From ad12bed8bbdd0898f8f04e323c3d41bc304082ab Mon Sep 17 00:00:00 2001 From: Cori Avila <42420333+corico44@users.noreply.github.com> Date: Thu, 25 May 2023 16:48:13 +0200 Subject: [PATCH] [bitnami/matomo] Add VIB tests (#34382) * [bitnami/matomo] Add initial tests Signed-off-by: Cori Avila * [bitnami/matomo] Add change in docker-compose file to trigger tests Signed-off-by: Cori Avila * [bitnami/matomo] Use owner and group from directories template Signed-off-by: Cori Avila * [bitnami/matomo] Fix check for directories Signed-off-by: Cori Avila * [bitnami/matomo] Add check for vhost file and add version check Signed-off-by: Cori Avila * [bitnami/matomo] Add check run and check version Signed-off-by: Cori Avila * [bitnami/matomo] 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: Cori Avila <42420333+corico44@users.noreply.github.com> --- .vib/matomo/goss/goss.yaml | 13 +++++++++++ .vib/matomo/goss/matomo.yaml | 44 ++++++++++++++++++++++++++++++++++++ .vib/matomo/goss/vars.yaml | 22 ++++++++++++++++++ .vib/matomo/vib-publish.json | 18 ++++++++++++++- .vib/matomo/vib-verify.json | 18 ++++++++++++++- 5 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 .vib/matomo/goss/goss.yaml create mode 100644 .vib/matomo/goss/matomo.yaml create mode 100644 .vib/matomo/goss/vars.yaml diff --git a/.vib/matomo/goss/goss.yaml b/.vib/matomo/goss/goss.yaml new file mode 100644 index 000000000000..f9544b02b1c7 --- /dev/null +++ b/.vib/matomo/goss/goss.yaml @@ -0,0 +1,13 @@ +gossfile: + # Goss tests exclusive to the current container + ../../matomo/goss/matomo.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-apache-libphp.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-files.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/matomo/goss/matomo.yaml b/.vib/matomo/goss/matomo.yaml new file mode 100644 index 000000000000..bbde2fc42ec8 --- /dev/null +++ b/.vib/matomo/goss/matomo.yaml @@ -0,0 +1,44 @@ +group: + daemon: + exists: true +user: + daemon: + exists: true +file: + # HTTPs vhost should have been properly rendered + /opt/bitnami/apache/conf/vhosts/matomo-https-vhost.conf: + exists: true + filetype: file + contains: + - "SSLEngine on" + - /DocumentRoot.*/opt/bitnami/matomo/ + /opt/bitnami/apache/conf/vhosts/htaccess/matomo-htaccess.conf: + exists: false + /opt/bitnami/php/etc/php.ini: + exists: true + filetype: file + contains: + - "memory_limit = 256M" + - "mysqli.allow_local_infile = 1" + - "extension = maxminddb.so" + /opt/bitnami/matomo/piwik: + exists: false + /opt/bitnami/matomo/How to install Matomo.html: + exists: false + /opt/bitnami/matomo/licenses: + exists: false + /opt/bitnami/matomo/.buildcomplete: + exists: false +command: + # Since it is not done with sudo, the exit code is 1 + check-app-version: + exec: php /opt/bitnami/matomo/console --version + exit-status: 1 + stdout: + - {{ .Env.APP_VERSION }} + # Since it is not done with sudo, the exit code is 1 + check-app-run: + exec: php /opt/bitnami/matomo/console config:get --section=database + exit-status: 1 + stdout: + - "Mysql" \ No newline at end of file diff --git a/.vib/matomo/goss/vars.yaml b/.vib/matomo/goss/vars.yaml new file mode 100644 index 000000000000..d370f23931e4 --- /dev/null +++ b/.vib/matomo/goss/vars.yaml @@ -0,0 +1,22 @@ +binaries: + - apachectl + - ini-file + - php + - mysql + - render-template +directories: + - mode: "0775" + owner: daemon + group: root + paths: + - /opt/bitnami/matomo + - /opt/bitnami/matomo/tmp + - /opt/bitnami/matomo/misc/ + - /opt/bitnami/matomo/misc/user + - /opt/bitnami/matomo/plugins + - /bitnami/matomo +files: + - paths: + - /opt/bitnami/matomo/piwik.js + - /opt/bitnami/matomo/piwik.php +root_dir: /opt/bitnami diff --git a/.vib/matomo/vib-publish.json b/.vib/matomo/vib-publish.json index 8b6fe8eab4e6..c47878828c97 100644 --- a/.vib/matomo/vib-publish.json +++ b/.vib/matomo/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": "matomo/goss/goss.yaml", + "vars_file": "matomo/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-matomo" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/matomo/vib-verify.json b/.vib/matomo/vib-verify.json index a34e8aee9161..c5eb10253fa2 100644 --- a/.vib/matomo/vib-verify.json +++ b/.vib/matomo/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": "matomo/goss/goss.yaml", + "vars_file": "matomo/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-matomo" + } + } + } + }, { "action_id": "trivy", "params": {