mirror of
https://github.com/bitnami/containers.git
synced 2026-04-03 07:47:45 +08:00
[bitnami/*] Refactor Goss' common tests (#24127)
* [bitnami/*] Refactor Goss' common tests Signed-off-by: FraPazGal <fdepaz@vmware.com> * Trigger VIB for MariaDB Signed-off-by: FraPazGal <fdepaz@vmware.com> * Fix path typo Signed-off-by: FraPazGal <fdepaz@vmware.com> * Trigger VIB for WordPress Signed-off-by: FraPazGal <fdepaz@vmware.com> * Trigger VIB for Apache Signed-off-by: FraPazGal <fdepaz@vmware.com> * Remove VIB triggers Signed-off-by: FraPazGal <fdepaz@vmware.com> * Add missing MariaDB tests and launch VIB pipeline Signed-off-by: FraPazGal <fdepaz@vmware.com> * Remove VIB trigger Signed-off-by: FraPazGal <fdepaz@vmware.com> --------- Signed-off-by: FraPazGal <fdepaz@vmware.com>
This commit is contained in:
committed by
GitHub
parent
8a5fd25163
commit
9d243a6d23
@@ -1,3 +1,19 @@
|
||||
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 }}
|
||||
file:
|
||||
# Main Apache config file includes other config files
|
||||
{{ .Vars.root_dir }}/apache/conf/httpd.conf:
|
||||
@@ -31,19 +47,3 @@ file:
|
||||
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 }}
|
||||
|
||||
@@ -3,10 +3,10 @@ gossfile:
|
||||
../../apache/goss/apache.yaml: {}
|
||||
# Load scripts from .vib/common/goss/templates
|
||||
../../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-components-binaries.yaml: {}
|
||||
../../common/goss/templates/check-components-files.yaml: {}
|
||||
../../common/goss/templates/check-directories-permissions.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-sed-in-place.yaml: {}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
components:
|
||||
binaries:
|
||||
- httpd
|
||||
- gosu
|
||||
- render-template
|
||||
files:
|
||||
- /opt/bitnami/apache/conf/modsecurity.conf
|
||||
- /opt/bitnami/apache/conf/unicode.mapping
|
||||
filesystem:
|
||||
binaries:
|
||||
- httpd
|
||||
- gosu
|
||||
- render-template
|
||||
files:
|
||||
- paths:
|
||||
- /opt/bitnami/apache/conf/modsecurity.conf
|
||||
- /opt/bitnami/apache/conf/unicode.mapping
|
||||
directories:
|
||||
- mode: "0775"
|
||||
directories:
|
||||
paths:
|
||||
- /opt/bitnami/apache/var/run
|
||||
- /opt/bitnami/apache/conf
|
||||
- /opt/bitnami/apache/logs
|
||||
@@ -46,4 +46,4 @@ modules:
|
||||
root_dir: /opt/bitnami
|
||||
version:
|
||||
bin_name: apachectl
|
||||
flag: -v
|
||||
flag: -v
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
########################
|
||||
# Checks components binaries are added to the $PATH
|
||||
# Checks binaries are added to the $PATH
|
||||
# Needed vars:
|
||||
# - .Vars.components.binaries (Array)
|
||||
# - .Vars.binaries (Array)
|
||||
########################
|
||||
command:
|
||||
{{ range $binary := .Vars.components.binaries }}
|
||||
{{ range $binary := .Vars.binaries }}
|
||||
check-{{ $binary }}-binary:
|
||||
exec: which {{ $binary }}
|
||||
exit-status: 0
|
||||
@@ -1,11 +0,0 @@
|
||||
########################
|
||||
# Checks components directories exist
|
||||
# Needed vars:
|
||||
# - .Vars.components.directories (Array)
|
||||
########################
|
||||
file:
|
||||
{{ range $directory := .Vars.components.directories }}
|
||||
{{ $directory }}:
|
||||
exists: true
|
||||
filetype: directory
|
||||
{{ end }}
|
||||
@@ -1,11 +0,0 @@
|
||||
########################
|
||||
# Checks components files exist
|
||||
# Needed vars:
|
||||
# - .Vars.components.files (Array)
|
||||
########################
|
||||
file:
|
||||
{{ range $file := .Vars.components.files }}
|
||||
{{ $file }}:
|
||||
exists: true
|
||||
filetype: file
|
||||
{{ end }}
|
||||
@@ -1,17 +0,0 @@
|
||||
########################
|
||||
# Checks directories permissions, usually changed in the postunpack stage
|
||||
# Needed vars:
|
||||
# - .Vars.filesystem (Array)
|
||||
# - .Vars.filesystem.directories (Array)
|
||||
# - .Vars.filesystem.mode (String)
|
||||
########################
|
||||
file:
|
||||
{{ range .Vars.filesystem }}
|
||||
{{ $mode := .mode }}
|
||||
{{ range $directory := .directories }}
|
||||
{{ $directory }}:
|
||||
exists: true
|
||||
filetype: directory
|
||||
mode: "{{ $mode }}"
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
23
.vib/common/goss/templates/check-directories.yaml
Normal file
23
.vib/common/goss/templates/check-directories.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
########################
|
||||
# Checks directories exist,
|
||||
# optionally checking their permissions
|
||||
# Needed vars:
|
||||
# - .Vars.directories (Array)
|
||||
# - .Vars.directories.paths (Array)
|
||||
# - .Vars.directories.mode (Optional - String)
|
||||
########################
|
||||
file:
|
||||
{{ range .Vars.directories }}
|
||||
{{ $mode := "" }}
|
||||
{{ if (gt (len .) 1) }}
|
||||
{{ $mode = .mode }}
|
||||
{{ end }}
|
||||
{{ range $directory := .paths }}
|
||||
{{ $directory }}:
|
||||
exists: true
|
||||
filetype: directory
|
||||
{{ if $mode }}
|
||||
mode: "{{ $mode }}"
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
23
.vib/common/goss/templates/check-files.yaml
Normal file
23
.vib/common/goss/templates/check-files.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
########################
|
||||
# Checks files exist,
|
||||
# optionally checking their permissions
|
||||
# Needed vars:
|
||||
# - .Vars.files (Array)
|
||||
# - .Vars.files.paths (Array)
|
||||
# - .Vars.directories.mode (Optional - String)
|
||||
########################
|
||||
file:
|
||||
{{ range .Vars.files }}
|
||||
{{ $mode := "" }}
|
||||
{{ if (gt (len .) 1) }}
|
||||
{{ $mode = .mode }}
|
||||
{{ end }}
|
||||
{{ range $file := .paths }}
|
||||
{{ $file }}:
|
||||
exists: true
|
||||
filetype: file
|
||||
{{ if $mode }}
|
||||
mode: "{{ $mode }}"
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -1,11 +1,11 @@
|
||||
gossfile:
|
||||
# Goss tests exclusive to the current container
|
||||
../../mariadb/goss/templates/mariadb.yaml: {}
|
||||
../../mariadb/goss/mariadb.yaml: {}
|
||||
# Load scripts from .vib/common/goss/templates
|
||||
../../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-components-binaries.yaml: {}
|
||||
../../common/goss/templates/check-directories-permissions.yaml: {}
|
||||
../../common/goss/templates/check-directories.yaml: {}
|
||||
../../common/goss/templates/check-linked-libraries.yaml: {}
|
||||
../../common/goss/templates/check-sed-in-place.yaml: {}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
components:
|
||||
binaries:
|
||||
- gosu
|
||||
- ini-file
|
||||
- mysql
|
||||
filesystem:
|
||||
binaries:
|
||||
- gosu
|
||||
- ini-file
|
||||
- mysql
|
||||
directories:
|
||||
- mode: "0775"
|
||||
directories:
|
||||
paths:
|
||||
- /bitnami/mariadb
|
||||
- /bitnami/mariadb/data
|
||||
- /opt/bitnami/mariadb/conf
|
||||
|
||||
@@ -2,10 +2,10 @@ gossfile:
|
||||
# Goss tests exclusive to the current container
|
||||
../../wordpress/goss/wordpress.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-components-binaries.yaml: {}
|
||||
../../common/goss/templates/check-components-files.yaml: {}
|
||||
../../common/goss/templates/check-directories-permissions.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-sed-in-place.yaml: {}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
components:
|
||||
binaries:
|
||||
- apachectl
|
||||
- gosu
|
||||
- mariadb
|
||||
- php
|
||||
- render-template
|
||||
- wp
|
||||
files:
|
||||
binaries:
|
||||
- apachectl
|
||||
- gosu
|
||||
- mariadb
|
||||
- php
|
||||
- render-template
|
||||
- wp
|
||||
files:
|
||||
- paths:
|
||||
- /opt/bitnami/apache/modules/libphp.so
|
||||
- /opt/bitnami/wordpress/wp-config.php
|
||||
filesystem:
|
||||
directories:
|
||||
- mode: "0775"
|
||||
directories:
|
||||
paths:
|
||||
- /bitnami/wordpress
|
||||
- /opt/bitnami/wordpress
|
||||
- /opt/bitnami/wordpress/tmp
|
||||
@@ -41,4 +41,4 @@ phpmodules:
|
||||
- zip
|
||||
# Specific from postunpack logic
|
||||
- memcached
|
||||
root_dir: /opt/bitnami
|
||||
root_dir: /opt/bitnami
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
command:
|
||||
check-app-version:
|
||||
exec: cat {{ .Vars.root_dir }}/wordpress/wp-includes/version.php | grep "wp_version"
|
||||
exit-status: 0
|
||||
stdout:
|
||||
- {{ .Env.APP_VERSION }}
|
||||
# WP-CLI points to correct binaries and config file
|
||||
check-wp-cli-conf:
|
||||
exec: wp --info
|
||||
exit-status: 0
|
||||
stdout:
|
||||
- "{{ .Vars.root_dir }}/php/bin/php"
|
||||
- "{{ .Vars.root_dir }}/mysql/bin/mysql"
|
||||
- "{{ .Vars.root_dir }}/wp-cli/conf/wp-cli.yml"
|
||||
check-enabled-modules:
|
||||
exec: php -m
|
||||
exit-status: 0
|
||||
stdout:
|
||||
{{ range $module := .Vars.phpmodules }}
|
||||
- "{{ $module }}"
|
||||
{{ end }}
|
||||
file:
|
||||
# HTTP vhost should have been properly rendered
|
||||
{{ .Vars.root_dir }}/apache/conf/vhosts/wordpress-vhost.conf:
|
||||
@@ -20,30 +41,9 @@ file:
|
||||
filetype: file
|
||||
contains:
|
||||
- /path.*{{ .Vars.root_dir }}/wordpress/
|
||||
command:
|
||||
check-app-version:
|
||||
exec: cat {{ .Vars.root_dir }}/wordpress/wp-includes/version.php | grep "wp_version"
|
||||
exit-status: 0
|
||||
stdout:
|
||||
- {{ .Env.APP_VERSION }}
|
||||
# WP-CLI points to correct binaries and config file
|
||||
check-wp-cli-conf:
|
||||
exec: wp --info
|
||||
exit-status: 0
|
||||
stdout:
|
||||
- "{{ .Vars.root_dir }}/php/bin/php"
|
||||
- "{{ .Vars.root_dir }}/mysql/bin/mysql"
|
||||
- "{{ .Vars.root_dir }}/wp-cli/conf/wp-cli.yml"
|
||||
check-enabled-modules:
|
||||
exec: php -m
|
||||
exit-status: 0
|
||||
stdout:
|
||||
{{ range $module := .Vars.phpmodules }}
|
||||
- "{{ $module }}"
|
||||
{{ end }}
|
||||
group:
|
||||
daemon:
|
||||
exists: true
|
||||
user:
|
||||
daemon:
|
||||
exists: true
|
||||
exists: true
|
||||
|
||||
Reference in New Issue
Block a user