Blame SOURCES/openscap-1.3.6-fix-failing-test-pr-1775.patch

02a573
From 11e5d42d279f39c13a9bdea7df6da7728b85a0b5 Mon Sep 17 00:00:00 2001
02a573
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
02a573
Date: Tue, 29 Jun 2021 09:12:34 +0200
02a573
Subject: [PATCH] Fix failing test
02a573
02a573
The test fails becuse the OVAL content in
02a573
`test_remediation_simple.oval.xml` used in rule
02a573
`xccdf_moc.elpmaxe.www_rule_1` in
02a573
`test_profile_selection_by_suffix.xccdf.xml` expects that a file named
02a573
`test_file` exists in the current working directory.
02a573
02a573
This test doesn't fail when executed as a part of complete test suite
02a573
run. I guess that it's because some other test creates the `test_file`
02a573
file and doesn't delete it. Unfortunately, I can't find which test
02a573
creates it. There are many test cases that use a file `test_file`
02a573
and it is also created often by remediation executed in some tests.
02a573
---
02a573
 .../API/XCCDF/unittests/test_profile_selection_by_suffix.sh  | 5 +++++
02a573
 1 file changed, 5 insertions(+)
02a573
02a573
diff --git a/tests/API/XCCDF/unittests/test_profile_selection_by_suffix.sh b/tests/API/XCCDF/unittests/test_profile_selection_by_suffix.sh
02a573
index 910264626a..9b0852df37 100755
02a573
--- a/tests/API/XCCDF/unittests/test_profile_selection_by_suffix.sh
02a573
+++ b/tests/API/XCCDF/unittests/test_profile_selection_by_suffix.sh
02a573
@@ -13,6 +13,9 @@ echo "Stderr file = $stderr"
02a573
 echo "Result file = $result"
02a573
 ret=0
02a573
 
02a573
+touch test_file
02a573
+[ -f test_file ]
02a573
+
02a573
 # Multiple matches should result in failure
02a573
 $OSCAP xccdf eval --profile common $benchmark 2> $stderr || ret=$?
02a573
 [ $ret -eq 1 ]
02a573
@@ -55,3 +58,5 @@ grep -Fq "No profile matching suffix \"another\" was found" $stderr
02a573
 
02a573
 [ -f $stderr ]; rm $stderr
02a573
 rm $result
02a573
+
02a573
+rm -f test_file