Blame SOURCES/01-add-test-fix-type-anaconda.patch

ca8ab9
From 712000a675103393045fde191856ce1dd306f1ca Mon Sep 17 00:00:00 2001
ca8ab9
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
ca8ab9
Date: Mon, 13 Jan 2020 17:28:09 +0100
ca8ab9
Subject: [PATCH] Add a test to check --fix-type Anaconda
ca8ab9
ca8ab9
There should be 2 equal ways of generating Anaconda remediations:
ca8ab9
"oscap xccdf generate fix --fix-type anaconda" and
ca8ab9
"oscap xccdf generate fix --template urn:redhat:anaconda:pre"
ca8ab9
Both commands should give the same output.
ca8ab9
This tests a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1736850
ca8ab9
introduced by b1448ec95a957a76eb8be6d439531c532d97ff3c
ca8ab9
---
ca8ab9
 .../API/XCCDF/unittests/test_report_anaconda_fixes.sh  | 10 ++++++++++
ca8ab9
 1 file changed, 10 insertions(+)
ca8ab9
ca8ab9
diff --git a/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh b/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh
ca8ab9
index d4e86e657..650f3d75b 100755
ca8ab9
--- a/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh
ca8ab9
+++ b/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh
ca8ab9
@@ -23,6 +23,16 @@ grep -v "$line1" $result | grep -v "$line2" | grep -v "$line3"
ca8ab9
 [ "`grep -v "$line1" $result | grep -v "$line2" | sed 's/\W//g'`"x == x ]
ca8ab9
 :> $result
ca8ab9
 
ca8ab9
+# use --fix-type instead of URN template to generate the same fix
ca8ab9
+$OSCAP xccdf generate fix --fix-type anaconda \
ca8ab9
+	--output $result $srcdir/${name}.xccdf.xml 2>&1 > $stderr
ca8ab9
+[ -f $stderr ]; [ ! -s $stderr ]; :> $stderr
ca8ab9
+grep "$line1" $result
ca8ab9
+grep "$line2" $result
ca8ab9
+grep -v "$line1" $result | grep -v "$line2" | grep -v "$line3"
ca8ab9
+[ "`grep -v "$line1" $result | grep -v "$line2" | sed 's/\W//g'`"x == x ]
ca8ab9
+:> $result
ca8ab9
+
ca8ab9
 $OSCAP xccdf generate fix --template urn:redhat:anaconda:pre \
ca8ab9
 	--profile xccdf_moc.elpmaxe.www_profile_1 \
ca8ab9
 	--output $result $srcdir/${name}.xccdf.xml 2>&1 > $stderr