test/cases/api: add modules

This commit is contained in:
Sanne Raymaekers 2025-03-14 12:08:16 +01:00
parent ec93197b7a
commit d08cedf73b
6 changed files with 31 additions and 4 deletions

View file

@ -529,6 +529,22 @@ fi
export EXTRA_PAYLOAD_REPOS_BLOCK export EXTRA_PAYLOAD_REPOS_BLOCK
export EXTRA_PACKAGES_BLOCK export EXTRA_PACKAGES_BLOCK
ENABLED_MODULES_BLOCK=
# Only test modularity on rhel 8 and 9
if [[ ($ID == rhel || $ID == centos) && ${VERSION_ID%.*} -lt 10 ]]; then
ENABLED_MODULES_BLOCK=$(cat <<EndOfMessage
,
"enabled_modules": [
{
"name": "nodejs",
"stream" :"20"
}
]
EndOfMessage
)
fi
export ENABLED_MODULES_BLOCK
# generate a temp key for user tests # generate a temp key for user tests
ssh-keygen -t rsa-sha2-512 -f "${WORKDIR}/usertest" -C "usertest" -N "" ssh-keygen -t rsa-sha2-512 -f "${WORKDIR}/usertest" -C "usertest" -N ""

View file

@ -50,6 +50,7 @@ function createReqFile() {
}${EXTRA_PAYLOAD_REPOS_BLOCK} }${EXTRA_PAYLOAD_REPOS_BLOCK}
], ],
"packages": [ "packages": [
"nodejs",
"postgresql", "postgresql",
"dummy"${EXTRA_PACKAGES_BLOCK} "dummy"${EXTRA_PACKAGES_BLOCK}
], ],
@ -64,7 +65,7 @@ function createReqFile() {
"key": "$(cat "${WORKDIR}/usertest.pub")" "key": "$(cat "${WORKDIR}/usertest.pub")"
} }
]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK} ]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK}
${TIMEZONE_CUSTOMIZATION_BLOCK}${RPM_CUSTOMIZATION_BLOCK}${RHSM_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK} ${TIMEZONE_CUSTOMIZATION_BLOCK}${RPM_CUSTOMIZATION_BLOCK}${RHSM_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK}${ENABLED_MODULES_BLOCK}
}, },
"image_request": { "image_request": {
"architecture": "$ARCH", "architecture": "$ARCH",

View file

@ -82,10 +82,11 @@ function createReqFile() {
} }
], ],
"packages": [ "packages": [
"nodejs",
"postgresql", "postgresql",
"dummy" "dummy"
]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK} ]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK}
${TIMEZONE_CUSTOMIZATION_BLOCK}${FIREWALL_CUSTOMIZATION_BLOCK}${RPM_CUSTOMIZATION_BLOCK}${RHSM_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK} ${TIMEZONE_CUSTOMIZATION_BLOCK}${FIREWALL_CUSTOMIZATION_BLOCK}${RPM_CUSTOMIZATION_BLOCK}${RHSM_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK}${ENABLED_MODULES_BLOCK}
}, },
"image_request": { "image_request": {
"architecture": "$ARCH", "architecture": "$ARCH",

View file

@ -37,6 +37,13 @@ function _instanceCheck() {
# Check if postgres is installed # Check if postgres is installed
$_ssh rpm -q postgresql dummy $_ssh rpm -q postgresql dummy
MODULE=$(cat "$REQUEST_FILE" | jq -r .customizations.enabled_modules[0])
if [ "$MODULE" = "nodejs:20" ]; then
echo "checking if nodejs 20 is installed: $($_ssh rpm -q nodejs)"
$_ssh rpm -q nodejs | grep -q nodejs-20
fi
# Verify subscribe status. Loop check since the system may not be registered such early(RHEL only) # Verify subscribe status. Loop check since the system may not be registered such early(RHEL only)
if [[ "$ID" == "rhel" ]]; then if [[ "$ID" == "rhel" ]]; then
set +eu set +eu

View file

@ -69,10 +69,11 @@ function createReqFile() {
} }
], ],
"packages": [ "packages": [
"nodejs",
"postgresql", "postgresql",
"dummy" "dummy"
]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK} ]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK}
${TIMEZONE_CUSTOMIZATION_BLOCK}${FIREWALL_CUSTOMIZATION_BLOCK}${RPM_CUSTOMIZATION_BLOCK}${RHSM_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK} ${TIMEZONE_CUSTOMIZATION_BLOCK}${FIREWALL_CUSTOMIZATION_BLOCK}${RPM_CUSTOMIZATION_BLOCK}${RHSM_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK}${ENABLED_MODULES_BLOCK}
}, },
"image_request": { "image_request": {
"architecture": "$ARCH", "architecture": "$ARCH",

View file

@ -74,10 +74,11 @@ function createReqFile() {
} }
], ],
"packages": [ "packages": [
"nodejs",
"postgresql", "postgresql",
"dummy" "dummy"
]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK} ]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}${REPOSITORY_CUSTOMIZATION_BLOCK}${OPENSCAP_CUSTOMIZATION_BLOCK}
${TIMEZONE_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK} ${TIMEZONE_CUSTOMIZATION_BLOCK}${CACERTS_CUSTOMIZATION_BLOCK}${ENABLED_MODULES_BLOCK}
}, },
"image_request": { "image_request": {
"architecture": "$ARCH", "architecture": "$ARCH",