[bitnami/nginx] Add VIB tests (#27513)

* [bitnami/nginx] Add VIB tests

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Trigger VIB

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Remove VIB trigger

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Use fullpath for asset tests

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Add missing binary check

Signed-off-by: FraPazGal <fdepaz@vmware.com>

---------

Signed-off-by: FraPazGal <fdepaz@vmware.com>
This commit is contained in:
Francisco de Paz Galan
2023-03-17 11:30:18 +01:00
committed by GitHub
parent 6881196a7c
commit 3806c75844
5 changed files with 157 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
gossfile:
# Goss tests exclusive to the current container
../../nginx/goss/nginx.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: {}
+57
View File
@@ -0,0 +1,57 @@
file:
# Checks configured symlinks
/opt/bitnami/nginx/conf/bitnami/certs:
exists: true
filetype: symlink
linked-to: /certs
/opt/bitnami/nginx/html:
exists: true
filetype: symlink
linked-to: /app
/opt/bitnami/nginx/logs/access.log:
exists: true
filetype: symlink
linked-to: /dev/stdout
/opt/bitnami/nginx/logs/error.log:
exists: true
filetype: symlink
linked-to: /dev/stderr
# Check selected dirs are not present
/opt/bitnami/certs:
exists: false
/opt/bitnami/server_blocks:
exists: false
# Check custom config
/opt/bitnami/nginx/conf/nginx.conf:
exists: true
filetype: file
contains:
- /listen.*{{ .Vars.ports.http }}/
/opt/bitnami/nginx/conf/fastcgi_params:
exists: true
filetype: file
contains:
- /Unset.*HTTP_PROXY/
command:
check-app-version:
exec: {{ .Vars.version.bin_name }} {{ .Vars.version.flag }} 2>&1
exit-status: 0
stdout:
- {{ .Env.APP_VERSION }}
test-config:
exec: nginx -t
exit-status: 0
# Check enabled config and added/enabled modules at compilation time
check-compilation-opts:
exec: nginx -V 2>&1
exit-status: 0
stdout:
{{ range $added_module := .Vars.modules.added }}
- nginx-module-{{ $added_module }}
{{ end }}
{{ range $enabled_module := .Vars.modules.enabled }}
- with-{{ $enabled_module }}_module
{{ end }}
{{ range $additional_config := .Vars.config_opts }}
- with-{{ $additional_config }}
{{ end }}
+53
View File
@@ -0,0 +1,53 @@
binaries:
- gosu
- nginx
- render-template
config_opts:
- stream
- mail
- threads
- compat
directories:
- mode: "0775"
paths:
- /bitnami/nginx
- /opt/bitnami/nginx/conf
- /opt/bitnami/nginx/conf/bitnami
- /opt/bitnami/nginx/conf/server_blocks
- /opt/bitnami/nginx/logs
- /opt/bitnami/nginx/tmp
- /docker-entrypoint-initdb.d
- paths:
- /app
- /certs
files:
- paths:
- /opt/bitnami/nginx/logs/access.log
- /opt/bitnami/nginx/logs/error.log
- /opt/bitnami/nginx/conf/nginx.conf.default
modules:
added:
- brotli
- geoip2
- substitutions-filter
- vts
enabled:
- http_stub_status
- http_gzip_static
- http_realip
- http_stub_status
- http_v2
- http_ssl
- mail_ssl
- http_gunzip
- http_auth_request
- http_sub
- http_geoip
- stream_realip
- stream_ssl
ports:
http: 8080
root_dir: /opt/bitnami
version:
bin_name: nginx
flag: -v
+17 -1
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": "nginx/goss/goss.yaml",
"vars_file": "nginx/goss/vars.yaml",
"remote": {
"pod": {
"workload": "deploy-nginx"
}
}
}
},
{
"action_id": "trivy",
"params": {
+18 -2
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": "nginx/goss/goss.yaml",
"vars_file": "nginx/goss/vars.yaml",
"remote": {
"pod": {
"workload": "deploy-nginx"
}
}
}
},
{
"action_id": "trivy",
"params": {
@@ -50,4 +66,4 @@
]
}
}
}
}