[bitnami/apache] Add VIB tests (#23837)

* [bitnami/apache] Add VIB tests

Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com>

* Remove VIB trigger

Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com>

---------

Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com>
This commit is contained in:
Jose Antonio Carmona
2023-02-14 12:31:12 +01:00
committed by GitHub
parent 3cc89fd554
commit 28796b98d1
5 changed files with 140 additions and 2 deletions

View File

@@ -0,0 +1,49 @@
file:
# Main Apache config file includes other config files
{{ .Vars.root_dir }}/apache/conf/httpd.conf:
exists: true
filetype: file
contains:
- /^Include.*{{ .Vars.root_dir }}/apache/conf/bitnami/bitnami.conf/
- /^Include.*{{ .Vars.root_dir }}/apache/conf/vhosts/\*.conf/
- /^Include.*{{ .Vars.root_dir }}/apache/conf/deflate.conf/
# Main Bitnami config file was correctly generated
{{ .Vars.root_dir }}/apache/conf/bitnami/bitnami.conf:
exists: true
filetype: file
contains:
- /DocumentRoot.*{{ .Vars.root_dir }}/apache/htdocs/
- /^Include.*{{ .Vars.root_dir }}/apache/conf/bitnami/bitnami-ssl.conf/
# Main Bitnami ssl config file was correctly generated
{{ .Vars.root_dir }}/apache/conf/bitnami/bitnami-ssl.conf:
exists: true
filetype: file
contains:
- "SSLProtocol all -SSLv2 -SSLv3"
- /SSLCertificateFile.*bitnami/certs/server.crt/
- /SSLCertificateKeyFile.*bitnami/certs/server.key/
# CGI folder has been removed, as recommended by Apache
{{ .Vars.root_dir }}/apache/cgi-bin:
exists: false
# Compiled disabled modules should have been generated
{{ range $module := .Vars.modules.extra }}
{{ $.Vars.root_dir }}/apache/modules/mod_{{ $module }}.so:
exists: true
filetype: file
{{ end }}
command:
# There are no syntax error in the configuration
check-configuration:
exec: apachectl -t
exit-status: 0
# Check explicitly enabled and disabled modules
check-loaded-modules:
exec: apachectl -M
exit-status: 0
stdout:
{{ range $module := .Vars.modules.loaded }}
- "{{ $module }}_module"
{{ end }}
{{ range $module := .Vars.modules.disabled }}
- "!{{ $module }}_module"
{{ end }}

View File

@@ -0,0 +1,12 @@
gossfile:
# Goss tests exclusive to the current container
../../apache/goss/apache.yaml: {}
# Load scripts from .vib/common/goss/templates
../../common/goss/templates/check-app-version.yaml: {}
../../common/goss/templates/check-broken-symlinks.yaml: {}
../../common/goss/templates/check-ca-certs.yaml: {}
../../common/goss/templates/check-components-binaries.yaml: {}
../../common/goss/templates/check-components-files.yaml: {}
../../common/goss/templates/check-directories-permissions.yaml: {}
../../common/goss/templates/check-linked-libraries.yaml: {}
../../common/goss/templates/check-sed-in-place.yaml: {}

View File

@@ -0,0 +1,49 @@
components:
binaries:
- httpd
- gosu
- render-template
files:
- /opt/bitnami/apache/conf/modsecurity.conf
- /opt/bitnami/apache/conf/unicode.mapping
filesystem:
- mode: "0775"
directories:
- /opt/bitnami/apache/var/run
- /opt/bitnami/apache/conf
- /opt/bitnami/apache/logs
- /opt/bitnami/apache/conf/vhosts
- /opt/bitnami/apache/conf/vhosts/htaccess
- /opt/bitnami/apache/htdocs
modules:
loaded:
# Explicitly enabled in postunpack
- deflate
- negotiation
- proxy
- proxy_http
- rewrite
- slotmem_shm
- socache_shmcb
- ssl
- status
- version
# Explicitly set at compilation time
- mpm_prefork
disabled:
# Explicitly disabled in postunpack
- http2
- proxy_hcheck
extra:
# Not enabled, but compiled
- mpm_event
- mpm_prefork
- mpm_worker
- http2
- ldap
- authnz_ldap
- security3
root_dir: /opt/bitnami
version:
bin_name: apachectl
flag: -v

View File

@@ -3,7 +3,8 @@
"resources": {
"url": "{VIB_ENV_CONTAINER_URL}",
"path": "{VIB_ENV_PATH}"
}
},
"runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd"
},
"phases": {
"package": {
@@ -33,6 +34,19 @@
},
"verify": {
"actions": [
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib"
},
"tests_file": "apache/goss/goss.yaml",
"vars_file": "apache/goss/vars.yaml",
"remote": {
"workload": "deploy-apache"
}
}
},
{
"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,19 @@
},
"verify": {
"actions": [
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib"
},
"tests_file": "apache/goss/goss.yaml",
"vars_file": "apache/goss/vars.yaml",
"remote": {
"workload": "deploy-apache"
}
}
},
{
"action_id": "trivy",
"params": {