Blob Blame History Raw
From 151699403803230e6d420b422cca13380b36e2a8 Mon Sep 17 00:00:00 2001
From: Trevor Vaughan <tvaughan@onyxpoint.com>
Date: Tue, 27 Mar 2018 18:04:34 -0400
Subject: [PATCH 24/25] Updated tests

Worked around the fact that data under the 'cas' directory is
dynamically provisioned by moving from `cmp` to `diff -q -I` in
run-tests.sh and excluding everything in the dynamically generated
space.

Ref #89
---
 tests/028-dbus/expected.out | 42 +++++++++++++++++++++++++++++++++++++++++-
 tests/033-scep/run.sh       |  6 +++---
 tests/run-tests.sh          |  4 +++-
 3 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out
index 4c33e9a..dd9cac1 100644
--- a/tests/028-dbus/expected.out
+++ b/tests/028-dbus/expected.out
@@ -536,6 +536,9 @@ After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.Stri
   </signal>
  </interface>
  <interface name="org.fedorahosted.certmonger.ca">
+  <method name="get_config_file_path">
+   <arg name="path" type="s" direction="out"/>
+  </method>
   <method name="get_nickname">
    <arg name="nickname" type="s" direction="out"/>
   </method>
@@ -580,6 +583,8 @@ After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.Stri
   <property name="ca-presave-uid" type="s" access="read"/>
   <property name="ca-postsave-command" type="s" access="read"/>
   <property name="ca-postsave-uid" type="s" access="read"/>
+  <property name="scep-cipher" type="s" access="readwrite"/>
+  <property name="scep-digest" type="s" access="readwrite"/>
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
   <property name="scep-ca-capabilities" type="as" access="read"/>
   <property name="scep-ra-cert" type="s" access="read"/>
@@ -588,6 +593,9 @@ After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.Stri
  </interface>
 </node>
 
+[ /org/fedorahosted/certmonger/cas/CA1: org.fedorahosted.certmonger.ca.get_config_file_path ]
+$tmpdir/cas/local
+
 [ /org/fedorahosted/certmonger/cas/CA1: org.fedorahosted.certmonger.ca.get_nickname ]
 local
 
@@ -641,6 +649,9 @@ dbus.Array([], signature=dbus.Signature('s'))
   </signal>
  </interface>
  <interface name="org.fedorahosted.certmonger.ca">
+  <method name="get_config_file_path">
+   <arg name="path" type="s" direction="out"/>
+  </method>
   <method name="get_nickname">
    <arg name="nickname" type="s" direction="out"/>
   </method>
@@ -685,6 +696,8 @@ dbus.Array([], signature=dbus.Signature('s'))
   <property name="ca-presave-uid" type="s" access="read"/>
   <property name="ca-postsave-command" type="s" access="read"/>
   <property name="ca-postsave-uid" type="s" access="read"/>
+  <property name="scep-cipher" type="s" access="readwrite"/>
+  <property name="scep-digest" type="s" access="readwrite"/>
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
   <property name="scep-ca-capabilities" type="as" access="read"/>
   <property name="scep-ra-cert" type="s" access="read"/>
@@ -693,6 +706,9 @@ dbus.Array([], signature=dbus.Signature('s'))
  </interface>
 </node>
 
+[ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.get_config_file_path ]
+$tmpdir/cas/20180327134236
+
 [ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.get_nickname ]
 SelfSign
 
@@ -715,7 +731,7 @@ dbus.Array([], signature=dbus.Signature('s'))
 [ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.refresh ]
 1
 
-/org/fedorahosted/certmonger/cas/CA2: warning: property org.fedorahosted.certmonger.ca.scep-ca-identifier not settable on this object
+/org/fedorahosted/certmonger/cas/CA2: property org.fedorahosted.certmonger.ca.scep-cipher not set: (, x)
 [ /org/fedorahosted/certmonger/cas/CA3: org.freedesktop.DBus.Introspectable.Introspect ]
 <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
@@ -748,6 +764,9 @@ dbus.Array([], signature=dbus.Signature('s'))
   </signal>
  </interface>
  <interface name="org.fedorahosted.certmonger.ca">
+  <method name="get_config_file_path">
+   <arg name="path" type="s" direction="out"/>
+  </method>
   <method name="get_nickname">
    <arg name="nickname" type="s" direction="out"/>
   </method>
@@ -792,6 +811,8 @@ dbus.Array([], signature=dbus.Signature('s'))
   <property name="ca-presave-uid" type="s" access="read"/>
   <property name="ca-postsave-command" type="s" access="read"/>
   <property name="ca-postsave-uid" type="s" access="read"/>
+  <property name="scep-cipher" type="s" access="readwrite"/>
+  <property name="scep-digest" type="s" access="readwrite"/>
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
   <property name="scep-ca-capabilities" type="as" access="read"/>
   <property name="scep-ra-cert" type="s" access="read"/>
@@ -800,6 +821,9 @@ dbus.Array([], signature=dbus.Signature('s'))
  </interface>
 </node>
 
+[ /org/fedorahosted/certmonger/cas/CA3: org.fedorahosted.certmonger.ca.get_config_file_path ]
+$tmpdir/cas/20180327134236-1
+
 [ /org/fedorahosted/certmonger/cas/CA3: org.fedorahosted.certmonger.ca.get_nickname ]
 IPA
 
@@ -853,6 +877,9 @@ dbus.Array([], signature=dbus.Signature('s'))
   </signal>
  </interface>
  <interface name="org.fedorahosted.certmonger.ca">
+  <method name="get_config_file_path">
+   <arg name="path" type="s" direction="out"/>
+  </method>
   <method name="get_nickname">
    <arg name="nickname" type="s" direction="out"/>
   </method>
@@ -897,6 +924,8 @@ dbus.Array([], signature=dbus.Signature('s'))
   <property name="ca-presave-uid" type="s" access="read"/>
   <property name="ca-postsave-command" type="s" access="read"/>
   <property name="ca-postsave-uid" type="s" access="read"/>
+  <property name="scep-cipher" type="s" access="readwrite"/>
+  <property name="scep-digest" type="s" access="readwrite"/>
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
   <property name="scep-ca-capabilities" type="as" access="read"/>
   <property name="scep-ra-cert" type="s" access="read"/>
@@ -905,6 +934,9 @@ dbus.Array([], signature=dbus.Signature('s'))
  </interface>
 </node>
 
+[ /org/fedorahosted/certmonger/cas/CA4: org.fedorahosted.certmonger.ca.get_config_file_path ]
+$tmpdir/cas/20180327134236-2
+
 [ /org/fedorahosted/certmonger/cas/CA4: org.fedorahosted.certmonger.ca.get_nickname ]
 certmaster
 
@@ -958,6 +990,9 @@ dbus.Array([], signature=dbus.Signature('s'))
   </signal>
  </interface>
  <interface name="org.fedorahosted.certmonger.ca">
+  <method name="get_config_file_path">
+   <arg name="path" type="s" direction="out"/>
+  </method>
   <method name="get_nickname">
    <arg name="nickname" type="s" direction="out"/>
   </method>
@@ -1002,6 +1037,8 @@ dbus.Array([], signature=dbus.Signature('s'))
   <property name="ca-presave-uid" type="s" access="read"/>
   <property name="ca-postsave-command" type="s" access="read"/>
   <property name="ca-postsave-uid" type="s" access="read"/>
+  <property name="scep-cipher" type="s" access="readwrite"/>
+  <property name="scep-digest" type="s" access="readwrite"/>
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
   <property name="scep-ca-capabilities" type="as" access="read"/>
   <property name="scep-ra-cert" type="s" access="read"/>
@@ -1010,6 +1047,9 @@ dbus.Array([], signature=dbus.Signature('s'))
  </interface>
 </node>
 
+[ /org/fedorahosted/certmonger/cas/CA5: org.fedorahosted.certmonger.ca.get_config_file_path ]
+$tmpdir/cas/20180327134236-3
+
 [ /org/fedorahosted/certmonger/cas/CA5: org.fedorahosted.certmonger.ca.get_nickname ]
 dogtag-ipa-renew-agent
 
diff --git a/tests/033-scep/run.sh b/tests/033-scep/run.sh
index 15480ac..f270a49 100755
--- a/tests/033-scep/run.sh
+++ b/tests/033-scep/run.sh
@@ -103,7 +103,7 @@ check_nonce() {
 	fi
 }
 
-set_digest md5
+set_digest sha256
 $toolsdir/scepgen ca entry > scepdata
 
 echo "[req, no trust root]"
@@ -135,7 +135,7 @@ grep ^gic: scepdata | cut -f2- -d: | base64 -i -d | $toolsdir/pk7verify -r mini.
 check_failed
 echo OK
 echo "[req, old root]"
-set_digest md5
+set_digest sha256
 $toolsdir/scepgen ca entry > scepdata
 if test x`grep ^req: scepdata | cut -f2- -d:` = x ; then
 	echo missing req
@@ -145,7 +145,7 @@ check_verified
 check_msgtype $SCEP_MSGTYPE_PKCSREQ
 check_txid
 check_nonce
-check_digest md5
+check_digest sha256
 echo OK
 echo "[gic, old trust root]"
 set_digest sha1
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index a0f7c2d..266ddc6 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -77,7 +77,9 @@ for testid in "$@" $subdirs ; do
 				if ! test -s "$i" ; then
 					break
 				fi
-				if cmp -s "$tmpfile" "$i" 2> /dev/null ; then
+				# This regex needs to be ignored since it is dynamically created at
+				# every CA creation
+				if diff -q -I "tmpdir/cas/[[:digit:]]\+" "$tmpfile" "$i" 2> /dev/null ; then
 					stat=0
 					echo "OK"
 					cp $tmpfile "$builddir"/"$testid"/actual.out
-- 
1.8.3.1