[bitnami/cassandra] Add VIB tests (#27809)
* [bitnami/cassandra] Add VIB tests Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Trigger VIB Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Remove specific test file Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Add excludePaths in sed-in-place Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Fix indentification of optional paths Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Fix command Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Test 4.0 Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Remove VIB trigger Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> * Apply suggestions Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com> --------- Signed-off-by: Jose Antonio Carmona <jcarmona@vmware.com>
This commit is contained in:
parent
f40225761e
commit
d74dfb6eed
|
|
@ -0,0 +1,11 @@
|
|||
gossfile:
|
||||
# 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-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: {}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
binaries:
|
||||
- cassandra
|
||||
- cqlsh
|
||||
- python
|
||||
- java
|
||||
- gosu
|
||||
- yq
|
||||
files:
|
||||
- mode: "0755"
|
||||
paths:
|
||||
- /opt/bitnami/cassandra/bin/cqlsh
|
||||
- paths:
|
||||
- /opt/bitnami/cassandra/conf.default
|
||||
directories:
|
||||
- mode: "0775"
|
||||
paths:
|
||||
- /.cassandra
|
||||
- /bitnami/cassandra
|
||||
- /bitnami/cassandra/conf
|
||||
- /opt/bitnami/cassandra/tmp
|
||||
- /opt/bitnami/cassandra/conf
|
||||
- /opt/bitnami/cassandra/logs
|
||||
- /docker-entrypoint-initdb.d
|
||||
root_dir: /opt/bitnami
|
||||
sed_in_place:
|
||||
exclude_paths:
|
||||
# Ignore PyLib directory (not bitnami-related)
|
||||
- \/opt\/bitnami\/cassandra\/pylib\/.*
|
||||
version:
|
||||
bin_name: cassandra
|
||||
flag: -v
|
||||
|
|
@ -3,7 +3,8 @@
|
|||
"resources": {
|
||||
"url": "{VIB_ENV_CONTAINER_URL}",
|
||||
"path": "{VIB_ENV_PATH}"
|
||||
}
|
||||
},
|
||||
"runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd"
|
||||
},
|
||||
"phases": {
|
||||
"package": {
|
||||
|
|
@ -32,6 +33,21 @@
|
|||
},
|
||||
"verify": {
|
||||
"actions": [
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib"
|
||||
},
|
||||
"tests_file": "cassandra/goss/goss.yaml",
|
||||
"vars_file": "cassandra/goss/vars.yaml",
|
||||
"remote": {
|
||||
"pod": {
|
||||
"workload": "deploy-cassandra"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "trivy",
|
||||
"params": {
|
||||
|
|
|
|||
|
|
@ -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": "cassandra/goss/goss.yaml",
|
||||
"vars_file": "cassandra/goss/vars.yaml",
|
||||
"remote": {
|
||||
"pod": {
|
||||
"workload": "deploy-cassandra"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "trivy",
|
||||
"params": {
|
||||
|
|
|
|||
|
|
@ -7,5 +7,8 @@ set -o pipefail
|
|||
mapfile -t files < <( find /bitnami "$BITNAMI_ROOT_DIR" -name '*.sh' )
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [[ -n $EXCLUDE_PATHS ]] && [[ "$file" =~ $EXCLUDE_PATHS ]]; then
|
||||
continue
|
||||
fi
|
||||
[[ $(grep -cE "sed -i|sed --in-place" "$file") -eq 0 ]] || exit 1
|
||||
done
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
# Needed vars:
|
||||
# - .Vars.directories (Array)
|
||||
# - .Vars.directories.paths (Array)
|
||||
# - .Vars.directories.mode (Optional - String)
|
||||
# Optional vars:
|
||||
# - .Vars.directories.mode (String)
|
||||
########################
|
||||
file:
|
||||
{{ range .Vars.directories }}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
# Needed vars:
|
||||
# - .Vars.files (Array)
|
||||
# - .Vars.files.paths (Array)
|
||||
# - .Vars.files.mode (Optional - String)
|
||||
# Optional vars:
|
||||
# - .Vars.files.mode (String)
|
||||
########################
|
||||
file:
|
||||
{{ range .Vars.files }}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
# Check components executables have no missing linked libraries
|
||||
# Needed vars:
|
||||
# - .Vars.root_dir
|
||||
# - .Vars.linked_libraries.exclude_paths (Optional - Array)
|
||||
# Optional vars:
|
||||
# - .Vars.linked_libraries.exclude_paths (Array)
|
||||
########################
|
||||
command:
|
||||
check-linked-libraries:
|
||||
{{ $exclude_paths := "" }}
|
||||
{{ if contains "exclude_paths:" (.Vars | toString) }}
|
||||
{{ if contains "linked_libraries:map[exclude_paths:" (.Vars | toString) }}
|
||||
{{ $exclude_paths = (.Vars.linked_libraries.exclude_paths | join "|") }}
|
||||
{{ end }}
|
||||
exec: export BITNAMI_ROOT_DIR={{ .Vars.root_dir }} && export EXCLUDE_PATHS='{{ $exclude_paths }}' && ./common/goss/scripts/check-linked-libraries.sh
|
||||
|
|
|
|||
|
|
@ -3,8 +3,15 @@
|
|||
# to sed commands with the in-place argument
|
||||
# Needed vars:
|
||||
# - .Vars.root_dir
|
||||
# Optional vars:
|
||||
# - .Vars.sed_in_place.exclude_paths (Array)
|
||||
########################
|
||||
command:
|
||||
check-sed-in-place:
|
||||
exec: export BITNAMI_ROOT_DIR={{ .Vars.root_dir }} && ./common/goss/scripts/check-sed-in-place.sh
|
||||
{{ $exclude_paths := "" }}
|
||||
{{ if contains "sed_in_place:map[exclude_paths:" (.Vars | toString) }}
|
||||
{{ $exclude_paths = (.Vars.sed_in_place.exclude_paths | join "|") }}
|
||||
{{ end }}
|
||||
exec: export BITNAMI_ROOT_DIR={{ .Vars.root_dir }} && export EXCLUDE_PATHS='{{ $exclude_paths }}' && ./common/goss/scripts/check-sed-in-place.sh
|
||||
timeout: 20000
|
||||
exit-status: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue