openscap/openscap-1.3.6-fix-failing-test-pr-1775.patch
Jan Černý 71d8346d4a Fix failing tests
- fix test tests/API/XCCDF/unittests/test_profile_selection_by_suffix.sh
  from upstream test suite (runs as a part of smoke test)
- oval/yamlfilecontent: Add 'null' values handling

Resolves: RHBZ#1952789
2021-06-30 11:21:12 +02:00

41 lines
1.6 KiB
Diff

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