From 943d487ae7adc3da96dacde1dbae464ff881ca9d Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Thu, 5 Sep 2024 14:47:52 +0200 Subject: [PATCH] test/api: check openscap facts when appropriate --- test/cases/api.sh | 1 + test/cases/api/common/common.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/cases/api.sh b/test/cases/api.sh index b504b64726..5b1d6287ac 100755 --- a/test/cases/api.sh +++ b/test/cases/api.sh @@ -409,6 +409,7 @@ case "${IMAGE_TYPE}" in , "openscap": { "profile_id": "pci-dss", + "policy_id": "1af6cced-581c-452c-89cd-33b7bddb816a", "tailoring": { "unselected": [ "rpm_verify_permissions" ] } diff --git a/test/cases/api/common/common.sh b/test/cases/api/common/common.sh index 5faf25bb0f..383b60d169 100644 --- a/test/cases/api/common/common.sh +++ b/test/cases/api/common/common.sh @@ -40,11 +40,24 @@ function _instanceCheck() { FACTS=$($_ssh sudo subscription-manager facts) if ! grep -q "image-builder.osbuild-composer.api-type: cloudapi-v2" <<< "$FACTS"; then - echo "System doesn't contain the expected osbuild facts" + echo "System doesn't contain the expected image-builder.osbuild-composer facts" echo "$FACTS" | grep image-builder exit 1 fi + if [ -n $OPENSCAP_CUSTOMIZATION_BLOCK ]; then + if ! grep -q "image-builder.insights.openscap-profile-id: pci-dss" <<< "$FACTS"; then + echo "System doesn't contain the expected image-builder.insights facts (profile-id)" + echo "$FACTS"| grep image-builder + exit 1 + fi + if ! grep -q "image-builder.insights.compliance-policy-id: 1af6cced-581c-452c-89cd-33b7bddb816a" <<< "$FACTS"; then + echo "System doesn't contain the expected image-builder.insights facts (policy-id)" + echo "$FACTS"| grep image-builder + exit 1 + fi + fi + # Unregister subscription $_ssh sudo subscription-manager unregister else