From 62c90fac16b937fd60ffecdc3dee7c2fbd9b4ed5 Mon Sep 17 00:00:00 2001 From: Cori Avila <42420333+corico44@users.noreply.github.com> Date: Thu, 25 May 2023 10:16:03 +0200 Subject: [PATCH] [bitnami/mastodon] Add VIB tests (#34942) * [bitmami/mastodon] Add initial tests Signed-off-by: Cori Avila * [bitmami/mastodon] Fix binaries check Signed-off-by: Cori Avila * [bitmami/mastodon] Fix content of file check Signed-off-by: Cori Avila * [bitmami/mastodon] Add change in docker-compose file to trigger tests Signed-off-by: Cori Avila * [bitnami/mastodon] Add missing binary and add group for directories check Signed-off-by: Cori Avila * [bitnami/mastodon] 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/mastodon/goss/goss.yaml | 11 +++++++++++ .vib/mastodon/goss/mastodon.yaml | 22 ++++++++++++++++++++++ .vib/mastodon/goss/vars.yaml | 18 ++++++++++++++++++ .vib/mastodon/vib-publish.json | 18 +++++++++++++++++- .vib/mastodon/vib-verify.json | 18 +++++++++++++++++- 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .vib/mastodon/goss/goss.yaml create mode 100644 .vib/mastodon/goss/mastodon.yaml create mode 100644 .vib/mastodon/goss/vars.yaml diff --git a/.vib/mastodon/goss/goss.yaml b/.vib/mastodon/goss/goss.yaml new file mode 100644 index 000000000000..40124d04aef9 --- /dev/null +++ b/.vib/mastodon/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../mastodon/goss/mastodon.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../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: {} + ../../common/goss/templates/check-spdx.yaml: {} diff --git a/.vib/mastodon/goss/mastodon.yaml b/.vib/mastodon/goss/mastodon.yaml new file mode 100644 index 000000000000..a86c9dfff3e3 --- /dev/null +++ b/.vib/mastodon/goss/mastodon.yaml @@ -0,0 +1,22 @@ +group: + mastodon: + exists: true +user: + mastodon: + exists: true +file: + /opt/bitnami/mastodon/config/initializers/1_hosts.rb: + exists: true + filetype: file + contains: + - "https = ENV['MASTODON_HTTPS_ENABLED'] == 'true'" + - "config.hosts.clear if ENV['MASTODON_ALLOW_ALL_DOMAINS'] == 'true'" + /opt/bitnami/mastodon/config/environments/production.rb: + exists: true + filetype: file + contains: + - "config.force_ssl = ENV['MASTODON_HTTPS_ENABLED'] == 'true'" + /opt/mastodon: + exists: true + filetype: symlink + linked-to: /opt/bitnami/mastodon \ No newline at end of file diff --git a/.vib/mastodon/goss/vars.yaml b/.vib/mastodon/goss/vars.yaml new file mode 100644 index 000000000000..2a27045c61f0 --- /dev/null +++ b/.vib/mastodon/goss/vars.yaml @@ -0,0 +1,18 @@ +binaries: + - node + - psql + - python + - redis-cli + - ruby + - wait-for-port + - tootctl +directories: + - mode: "0775" + group: root + paths: + - /bitnami/mastodon + - /opt/bitnami/mastodon/tmp + - /opt/bitnami/mastodon/public + - /opt/bitnami/mastodon/public/system + - /opt/bitnami/mastodon/public/assets +root_dir: /opt/bitnami diff --git a/.vib/mastodon/vib-publish.json b/.vib/mastodon/vib-publish.json index 8d02746030d5..54d5f1e63b38 100644 --- a/.vib/mastodon/vib-publish.json +++ b/.vib/mastodon/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -29,6 +30,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "mastodon/goss/goss.yaml", + "vars_file": "mastodon/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-mastodon" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/mastodon/vib-verify.json b/.vib/mastodon/vib-verify.json index a34e8aee9161..55fa9289cfb8 100644 --- a/.vib/mastodon/vib-verify.json +++ b/.vib/mastodon/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": "mastodon/goss/goss.yaml", + "vars_file": "mastodon/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-mastodon" + } + } + } + }, { "action_id": "trivy", "params": {