mirror of
https://github.com/bitnami/containers.git
synced 2026-03-21 23:38:32 +08:00
[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:
committed by
GitHub
parent
f40225761e
commit
d74dfb6eed
11
.vib/cassandra/goss/goss.yaml
Normal file
11
.vib/cassandra/goss/goss.yaml
Normal file
@@ -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: {}
|
||||||
31
.vib/cassandra/goss/vars.yaml
Normal file
31
.vib/cassandra/goss/vars.yaml
Normal file
@@ -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": {
|
"resources": {
|
||||||
"url": "{VIB_ENV_CONTAINER_URL}",
|
"url": "{VIB_ENV_CONTAINER_URL}",
|
||||||
"path": "{VIB_ENV_PATH}"
|
"path": "{VIB_ENV_PATH}"
|
||||||
}
|
},
|
||||||
|
"runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd"
|
||||||
},
|
},
|
||||||
"phases": {
|
"phases": {
|
||||||
"package": {
|
"package": {
|
||||||
@@ -32,6 +33,21 @@
|
|||||||
},
|
},
|
||||||
"verify": {
|
"verify": {
|
||||||
"actions": [
|
"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",
|
"action_id": "trivy",
|
||||||
"params": {
|
"params": {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
"resources": {
|
"resources": {
|
||||||
"url": "{SHA_ARCHIVE}",
|
"url": "{SHA_ARCHIVE}",
|
||||||
"path": "{VIB_ENV_PATH}"
|
"path": "{VIB_ENV_PATH}"
|
||||||
}
|
},
|
||||||
|
"runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd"
|
||||||
},
|
},
|
||||||
"phases": {
|
"phases": {
|
||||||
"package": {
|
"package": {
|
||||||
@@ -29,6 +30,21 @@
|
|||||||
},
|
},
|
||||||
"verify": {
|
"verify": {
|
||||||
"actions": [
|
"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",
|
"action_id": "trivy",
|
||||||
"params": {
|
"params": {
|
||||||
|
|||||||
@@ -7,5 +7,8 @@ set -o pipefail
|
|||||||
mapfile -t files < <( find /bitnami "$BITNAMI_ROOT_DIR" -name '*.sh' )
|
mapfile -t files < <( find /bitnami "$BITNAMI_ROOT_DIR" -name '*.sh' )
|
||||||
|
|
||||||
for file in "${files[@]}"; do
|
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
|
[[ $(grep -cE "sed -i|sed --in-place" "$file") -eq 0 ]] || exit 1
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
# Needed vars:
|
# Needed vars:
|
||||||
# - .Vars.directories (Array)
|
# - .Vars.directories (Array)
|
||||||
# - .Vars.directories.paths (Array)
|
# - .Vars.directories.paths (Array)
|
||||||
# - .Vars.directories.mode (Optional - String)
|
# Optional vars:
|
||||||
|
# - .Vars.directories.mode (String)
|
||||||
########################
|
########################
|
||||||
file:
|
file:
|
||||||
{{ range .Vars.directories }}
|
{{ range .Vars.directories }}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
# Needed vars:
|
# Needed vars:
|
||||||
# - .Vars.files (Array)
|
# - .Vars.files (Array)
|
||||||
# - .Vars.files.paths (Array)
|
# - .Vars.files.paths (Array)
|
||||||
# - .Vars.files.mode (Optional - String)
|
# Optional vars:
|
||||||
|
# - .Vars.files.mode (String)
|
||||||
########################
|
########################
|
||||||
file:
|
file:
|
||||||
{{ range .Vars.files }}
|
{{ range .Vars.files }}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
# Check components executables have no missing linked libraries
|
# Check components executables have no missing linked libraries
|
||||||
# Needed vars:
|
# Needed vars:
|
||||||
# - .Vars.root_dir
|
# - .Vars.root_dir
|
||||||
# - .Vars.linked_libraries.exclude_paths (Optional - Array)
|
# Optional vars:
|
||||||
|
# - .Vars.linked_libraries.exclude_paths (Array)
|
||||||
########################
|
########################
|
||||||
command:
|
command:
|
||||||
check-linked-libraries:
|
check-linked-libraries:
|
||||||
{{ $exclude_paths := "" }}
|
{{ $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 "|") }}
|
{{ $exclude_paths = (.Vars.linked_libraries.exclude_paths | join "|") }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
exec: export BITNAMI_ROOT_DIR={{ .Vars.root_dir }} && export EXCLUDE_PATHS='{{ $exclude_paths }}' && ./common/goss/scripts/check-linked-libraries.sh
|
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
|
# to sed commands with the in-place argument
|
||||||
# Needed vars:
|
# Needed vars:
|
||||||
# - .Vars.root_dir
|
# - .Vars.root_dir
|
||||||
|
# Optional vars:
|
||||||
|
# - .Vars.sed_in_place.exclude_paths (Array)
|
||||||
########################
|
########################
|
||||||
command:
|
command:
|
||||||
check-sed-in-place:
|
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
|
exit-status: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user