Skip to content

Commit

Permalink
Add a test case for the invalid value
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-cerny committed Oct 15, 2024
1 parent f827978 commit d977ad5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/sce/test_prefer_sce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,21 @@ test_prefer_oval_explicit () {
rm -rf "$stdout" "$stderr" "$arf"
}

test_invalid_envi_variable () {
stdout=$(mktemp)
stderr=$(mktemp)
arf=$(mktemp)

OSCAP_PREFERRED_ENGINE="FOOBARVIM" $OSCAP xccdf eval --verbose INFO --progress --profile common --results-arf "$arf" > "$stdout" 2> "$stderr" "$srcdir/test_prefer_sce.ds.xml" || ret="$?"
grep -q "Unknown value of OSCAP_PREFFERED_ENGINE: 'FOOBARVIM'. It will be ignored." "$stderr"
grep -q "xccdf_org.openscap.www_rule_1:pass" "$stdout"
grep -q "I: oscap: Evaluating definition 'oval:org.openscap.www:def:1': OVAL check for rule 1." "$stderr"
! grep -q "I: oscap: Executing SCE check 'fedora/checks/sce/rule_1.sh'" "$stderr"

rm -rf "$stdout" "$stderr" "$arf"
}

test_prefer_sce_on
test_prefer_sce_off
test_prefer_oval_explicit
test_invalid_envi_variable

0 comments on commit d977ad5

Please sign in to comment.