[bitnami/postgresql] Add postgresql tests (#27833)

* [bitnami/postgres]: Add Posgresql container tests

Signed-off-by: Michiel <michield@vmware.com>
This commit is contained in:
Michiel
2023-03-28 16:35:09 +02:00
committed by GitHub
parent 96f92dfdb3
commit 9f2dce9ef8
5 changed files with 89 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
gossfile:
# Goss tests exclusive to the current container
../../postgresql/goss/postgresql.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: {}

View File

@@ -0,0 +1,18 @@
command:
# If the patch version is "0" the version is shown as "major.minor" without the patch version.
# In that case we append .0 to the version to match with APP_VERSION
check-version:
exec: {{ .Vars.version.bin_name }} {{ .Vars.version.flag }} | awk '{ if (split($NF, ver, ".") == 2) { $NF = $NF ".0" } print }'
stdout:
- {{ .Env.APP_VERSION }}
exit-status: 0
file:
/opt/bitnami/postgresql/logs/postgresql.log:
exists: true
filetype: symlink
linked-to: /dev/stdout
/opt/bitnami/postgresql/conf/postgresql.conf:
exists: true
mode: "0664"
contains:
- /^include_dir = 'conf.d'/

View File

@@ -0,0 +1,25 @@
binaries:
- gosu
- postgres
- psql
- pg_dump
- pg_dumpall
- pg_restore
files:
- paths:
- /opt/bitnami/postgresql/conf/pg_hba.conf
directories:
- mode: "0775"
paths:
- /bitnami/postgresql
- /bitnami/postgresql/conf
- /bitnami/postgresql/conf/conf.d
- /docker-entrypoint-initdb.d
- /opt/bitnami/postgresql/conf
- /opt/bitnami/postgresql/conf/conf.d
- /opt/bitnami/postgresql/logs
- /opt/bitnami/postgresql/tmp
root_dir: /opt/bitnami
version:
bin_name: postgres
flag: --version

View File

@@ -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": "postgresql/goss/goss.yaml",
"vars_file": "postgresql/goss/vars.yaml",
"remote": {
"pod": {
"workload": "deploy-postgresql"
}
}
}
},
{
"action_id": "trivy",
"params": {

View File

@@ -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": "postgresql/goss/goss.yaml",
"vars_file": "postgresql/goss/vars.yaml",
"remote": {
"pod": {
"workload": "deploy-postgresql"
}
}
}
},
{
"action_id": "trivy",
"params": {