From 3e6db54fe150bf35cc512a5474f0af35705467ef Mon Sep 17 00:00:00 2001 From: Francisco de Paz Galan Date: Wed, 5 Apr 2023 12:10:32 +0200 Subject: [PATCH] [bitnami/postgresql-repmgr] Add VIB tests (#28652) * [bitnami/postgresql-repmgr] Add VIB tests Signed-off-by: FraPazGal * Fix file check permissions Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal * Remove unused vars Signed-off-by: FraPazGal --------- Signed-off-by: FraPazGal --- .vib/postgresql-repmgr/goss/goss.yaml | 12 ++++++++ .../goss/postgresql-repmgr.yaml | 10 +++++++ .vib/postgresql-repmgr/goss/vars.yaml | 28 +++++++++++++++++++ .vib/postgresql-repmgr/vib-publish.json | 24 +++++++++++++--- .vib/postgresql-repmgr/vib-verify.json | 18 +++++++++++- 5 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 .vib/postgresql-repmgr/goss/goss.yaml create mode 100644 .vib/postgresql-repmgr/goss/postgresql-repmgr.yaml create mode 100644 .vib/postgresql-repmgr/goss/vars.yaml diff --git a/.vib/postgresql-repmgr/goss/goss.yaml b/.vib/postgresql-repmgr/goss/goss.yaml new file mode 100644 index 000000000000..68ec53fa9c9d --- /dev/null +++ b/.vib/postgresql-repmgr/goss/goss.yaml @@ -0,0 +1,12 @@ +gossfile: + # Goss tests exclusive to the current container + ../../postgresql-repmgr/goss/postgresql-repmgr.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-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/postgresql-repmgr/goss/postgresql-repmgr.yaml b/.vib/postgresql-repmgr/goss/postgresql-repmgr.yaml new file mode 100644 index 000000000000..6018bf79e781 --- /dev/null +++ b/.vib/postgresql-repmgr/goss/postgresql-repmgr.yaml @@ -0,0 +1,10 @@ +file: + /opt/bitnami/postgresql/logs/postgresql.log: + exists: true + filetype: symlink + linked-to: /dev/stdout +command: + # Major and Minor versions are often shown as and "x.y" instead of "x.y.0" + check-app-version: + exec: psql --version | grep "$(echo $APP_VERSION | sed -E 's|([0-9]+\.[0-9]+)\.0$|\1|g')" + exit-status: 0 \ No newline at end of file diff --git a/.vib/postgresql-repmgr/goss/vars.yaml b/.vib/postgresql-repmgr/goss/vars.yaml new file mode 100644 index 000000000000..f42b5ae1ae8b --- /dev/null +++ b/.vib/postgresql-repmgr/goss/vars.yaml @@ -0,0 +1,28 @@ +binaries: + - gosu + - psql + - pg_dump + - pg_dumpall + - pg_restore + - repmgr + - repmgrd +directories: + - mode: "0775" + paths: + - /bitnami/postgresql + - /bitnami/postgresql/conf + - /bitnami/postgresql/conf/conf.d + - /opt/bitnami/postgresql/conf + - /opt/bitnami/postgresql/conf/conf.d + - /opt/bitnami/postgresql/tmp + - /opt/bitnami/postgresql/logs + - /opt/bitnami/repmgr/conf + - /opt/bitnami/repmgr/tmp + - /docker-entrypoint-initdb.d + - paths: + - /opt/bitnami/repmgr/events +files: + - mode: "0775" + paths: + - /opt/bitnami/repmgr/events/router.sh +root_dir: /opt/bitnami diff --git a/.vib/postgresql-repmgr/vib-publish.json b/.vib/postgresql-repmgr/vib-publish.json index fdedec57153e..eb4cf3a4a469 100644 --- a/.vib/postgresql-repmgr/vib-publish.json +++ b/.vib/postgresql-repmgr/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -76,9 +77,24 @@ "url": "{VIB_ENV_PACKAGES_JSON_URL}", "path": "/{VIB_ENV_PATH}", "authn": { - "header": "Authorization", - "token": "Bearer {VIB_ENV_GITHUB_TOKEN}" - } + "header": "Authorization", + "token": "Bearer {VIB_ENV_GITHUB_TOKEN}" + } + } + } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "postgresql-repmgr/goss/goss.yaml", + "vars_file": "postgresql-repmgr/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-postgresql-repmgr" + } } } } diff --git a/.vib/postgresql-repmgr/vib-verify.json b/.vib/postgresql-repmgr/vib-verify.json index a34e8aee9161..e19adf652f12 100644 --- a/.vib/postgresql-repmgr/vib-verify.json +++ b/.vib/postgresql-repmgr/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -46,6 +47,21 @@ "OS" ] } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "postgresql-repmgr/goss/goss.yaml", + "vars_file": "postgresql-repmgr/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-postgresql-repmgr" + } + } + } } ] }