[bitnami/drupal] Add VIB tests (#29156)

* [bitnami/drupal] Add VIB tests

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add Goss action

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add runtime-parameters and VIB trigger

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Apply suggestions

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Apply suggestions

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Move libphp test to common lib

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Remove apachectl -t test

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Apply suggestions

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Remove triggers

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

---------

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>
This commit is contained in:
Miguel Ruiz
2023-05-12 16:24:37 +02:00
committed by GitHub
parent bf0a2d9344
commit a4d80c8587
6 changed files with 125 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
########################
# Test coverage for apache-libphp package
# Needed vars:
# - None
########################
command:
# Check explicitly enabled and disabled modules
check-apache-libphp-loaded-modules:
exec: apachectl -M
exit-status: 0
stdout:
- "php_module"
- "mpm_prefork_module"
- "!mpm_event_module"
file:
/opt/bitnami/apache/conf/httpd.conf:
exists: true
filetype: file
contains:
- "Include \"/opt/bitnami/apache/conf/bitnami/php.conf\""
/opt/bitnami/apache/conf/bitnami/php.conf:
exists: true
filetype: file
contains:
- "AddType application/x-httpd-php .php"
- "DirectoryIndex index.html index.htm index.php"

View File

@@ -0,0 +1,32 @@
file:
# HTTP vhost should have been properly rendered
/opt/bitnami/apache/conf/vhosts/drupal-vhost.conf:
exists: true
filetype: file
contains:
- /DocumentRoot.*/opt/bitnami/drupal/
# HTTPs vhost should have been properly rendered
/opt/bitnami/apache/conf/vhosts/drupal-https-vhost.conf:
exists: true
filetype: file
contains:
- "SSLEngine on"
- /DocumentRoot.*/opt/bitnami/drupal/
/opt/bitnami/apache/conf/vhosts/htaccess/drupal-htaccess.conf:
exists: true
filetype: file
contains:
- "Options -Indexes -ExecCGI -Includes -MultiViews"
- "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006"
- "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003"
- "php_flag engine off"
/opt/bitnami/drupal/sites/default/settings.php:
exists: true
filetype: file
contains:
- "$settings['trusted_host_patterns'] = array('^.*$');"
/opt/bitnami/php/etc/php.ini:
exists: true
filetype: file
contains:
- /^memory_limit = 256M/

View File

@@ -0,0 +1,13 @@
gossfile:
# Goss tests exclusive to the current container
../../drupal/goss/drupal.yaml: {}
# Load scripts from .vib/common/goss/templates
../../common/goss/templates/check-apache-libphp.yaml: {}
../../common/goss/templates/check-app-version.yaml: {}
../../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: {}

View File

@@ -0,0 +1,20 @@
binaries:
- apachectl
- mysql
- php
- render-template
- drush
directories:
- mode: "0775"
paths:
- /bitnami/drupal
- /opt/bitnami/drupal
- /opt/bitnami/drupal/sites/default/files
- /.drush
- paths:
- /opt/bitnami/drupal/themes
- /opt/bitnami/drupal/modules
root_dir: /opt/bitnami
version:
bin_name: drush
flag: status

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