[bitnami/java] Add VIB tests (#25810)

* [bitnami/java] Add VIB tests

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Trigger VIB

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Fix vars typo

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Remove linked libs tests and fix jar

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Compile jar testfile with java 1.8

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Remove VIB trigger

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Remove linked-libs test

Signed-off-by: FraPazGal <fdepaz@vmware.com>

* Apply suggestions

Signed-off-by: FraPazGal <fdepaz@vmware.com>

---------

Signed-off-by: FraPazGal <fdepaz@vmware.com>
This commit is contained in:
Francisco de Paz Galan 2023-03-07 17:49:26 +01:00 committed by GitHub
parent 6f726affb0
commit 39d5e0a26f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 3 deletions

9
.vib/java/goss/goss.yaml Normal file
View File

@ -0,0 +1,9 @@
gossfile:
# Goss tests exclusive to the current container
../../java/goss/java.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-files.yaml: {}
../../common/goss/templates/check-sed-in-place.yaml: {}

14
.vib/java/goss/java.yaml Normal file
View File

@ -0,0 +1,14 @@
command:
# Java 1.8 does not support --version, with -version printing to stderr
# We need to parse the printed version differently depending on the version:
# - Major versions are often shown as "x" instead of "x.0.0"
# - In Java 1.8, the printed version is 1.8.0_x, but $APP_VERSION is formated as 1.8.x
# - Versions are usually printed as x.y.z+b, but $APP_VERSION is formated as x.y.z-b
check-app-version:
exec: java -version 2>&1 | sed "s/+/-/g" | sed "s/0_//g" | grep "$(echo $APP_VERSION | sed -E 's|([0-9]+)\.0\.0$|\1|g')"
exit-status: 0
check-run-jar:
exec: java -jar ./java/goss/testfiles/HelloTest.jar
stdout:
- Hello VIB
exit-status: 0

Binary file not shown.

7
.vib/java/goss/vars.yaml Normal file
View File

@ -0,0 +1,7 @@
binaries:
- java
- gosu
files:
- paths:
- /opt/bitnami/java/legal/java.base/LICENSE
root_dir: /opt/bitnami

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": "java/goss/goss.yaml",
"vars_file": "java/goss/vars.yaml",
"remote": {
"workload": "deploy-java"
}
}
},
{
"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": "java/goss/goss.yaml",
"vars_file": "java/goss/vars.yaml",
"remote": {
"workload": "deploy-java"
}
}
},
{
"action_id": "trivy",
"params": {
@ -50,4 +64,4 @@
]
}
}
}
}