diff --git a/tests/API/XCCDF/unittests/CMakeLists.txt b/tests/API/XCCDF/unittests/CMakeLists.txt index 7a9b3b452c..164b795e0e 100644 --- a/tests/API/XCCDF/unittests/CMakeLists.txt +++ b/tests/API/XCCDF/unittests/CMakeLists.txt @@ -110,3 +110,4 @@ add_oscap_test("test_skip_rule.sh") add_oscap_test("test_no_newline_between_select_elements.sh") add_oscap_test("test_single_line_tailoring.sh") add_oscap_test("test_reference.sh") +add_oscap_test("test_remediation_bootc.sh") diff --git a/tests/API/XCCDF/unittests/test_remediation_bootc.ds.xml b/tests/API/XCCDF/unittests/test_remediation_bootc.ds.xml new file mode 100644 index 0000000000..311068bf8d --- /dev/null +++ b/tests/API/XCCDF/unittests/test_remediation_bootc.ds.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + 5.11.2 + 2021-02-01T08:07:06+01:00 + + + + + PASS + pass + + + + + + + + + + + + + + oval:org.openscap.www:var:1 + + + + + 100 + + + + + + + accepted + 1.0 + + Common hardening profile + This is a very cool profile + + + + + Rule 1: Install rsyslog package + + package install rsyslog + + + + Rule 2: Remove USBGuard + + package remove usbguard + + + + Rule 3: Install reboot package + + package install reboot + + + + Rule 4: Install podman package + + package install podman + + + + + diff --git a/tests/API/XCCDF/unittests/test_remediation_bootc.sh b/tests/API/XCCDF/unittests/test_remediation_bootc.sh new file mode 100755 index 0000000000..cf193e75a5 --- /dev/null +++ b/tests/API/XCCDF/unittests/test_remediation_bootc.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +. $builddir/tests/test_common.sh + +set -e +set -o pipefail + +name=$(basename $0 .sh) +result=$(mktemp) +stderr=$(mktemp) + +echo "Result file = $result" +echo "Stderr file = $stderr" + +$OSCAP xccdf generate fix --fix-type bootc --profile common "$srcdir/test_remediation_bootc.ds.xml" > "$result" 2> "$stderr" +[ -e $stderr ] + +diff -u "$srcdir/test_remediation_bootc_expected_output.sh" "$result" + +rm -rf "$stdout" "$stderr" "$result" diff --git a/tests/API/XCCDF/unittests/test_remediation_bootc_expected_output.sh b/tests/API/XCCDF/unittests/test_remediation_bootc_expected_output.sh new file mode 100644 index 0000000000..57a7ffb3df --- /dev/null +++ b/tests/API/XCCDF/unittests/test_remediation_bootc_expected_output.sh @@ -0,0 +1,8 @@ +#!/bin/bash +dnf -y install \ + rsyslog \ + reboot \ + podman + +dnf -y remove \ + usbguard