1495bf
From 151699403803230e6d420b422cca13380b36e2a8 Mon Sep 17 00:00:00 2001
1495bf
From: Trevor Vaughan <tvaughan@onyxpoint.com>
1495bf
Date: Tue, 27 Mar 2018 18:04:34 -0400
1495bf
Subject: [PATCH 24/25] Updated tests
1495bf
1495bf
Worked around the fact that data under the 'cas' directory is
1495bf
dynamically provisioned by moving from `cmp` to `diff -q -I` in
1495bf
run-tests.sh and excluding everything in the dynamically generated
1495bf
space.
1495bf
1495bf
Ref #89
1495bf
---
1495bf
 tests/028-dbus/expected.out | 42 +++++++++++++++++++++++++++++++++++++++++-
1495bf
 tests/033-scep/run.sh       |  6 +++---
1495bf
 tests/run-tests.sh          |  4 +++-
1495bf
 3 files changed, 47 insertions(+), 5 deletions(-)
1495bf
1495bf
diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out
1495bf
index 4c33e9a..dd9cac1 100644
1495bf
--- a/tests/028-dbus/expected.out
1495bf
+++ b/tests/028-dbus/expected.out
1495bf
@@ -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
1495bf
   </signal>
1495bf
  </interface>
1495bf
  <interface name="org.fedorahosted.certmonger.ca">
1495bf
+  <method name="get_config_file_path">
1495bf
+   <arg name="path" type="s" direction="out"/>
1495bf
+  </method>
1495bf
   <method name="get_nickname">
1495bf
    <arg name="nickname" type="s" direction="out"/>
1495bf
   </method>
1495bf
@@ -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
1495bf
   <property name="ca-presave-uid" type="s" access="read"/>
1495bf
   <property name="ca-postsave-command" type="s" access="read"/>
1495bf
   <property name="ca-postsave-uid" type="s" access="read"/>
1495bf
+  <property name="scep-cipher" type="s" access="readwrite"/>
1495bf
+  <property name="scep-digest" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-capabilities" type="as" access="read"/>
1495bf
   <property name="scep-ra-cert" type="s" access="read"/>
1495bf
@@ -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
1495bf
  </interface>
1495bf
 </node>
1495bf
 
1495bf
+[ /org/fedorahosted/certmonger/cas/CA1: org.fedorahosted.certmonger.ca.get_config_file_path ]
1495bf
+$tmpdir/cas/local
1495bf
+
1495bf
 [ /org/fedorahosted/certmonger/cas/CA1: org.fedorahosted.certmonger.ca.get_nickname ]
1495bf
 local
1495bf
 
1495bf
@@ -641,6 +649,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   </signal>
1495bf
  </interface>
1495bf
  <interface name="org.fedorahosted.certmonger.ca">
1495bf
+  <method name="get_config_file_path">
1495bf
+   <arg name="path" type="s" direction="out"/>
1495bf
+  </method>
1495bf
   <method name="get_nickname">
1495bf
    <arg name="nickname" type="s" direction="out"/>
1495bf
   </method>
1495bf
@@ -685,6 +696,8 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   <property name="ca-presave-uid" type="s" access="read"/>
1495bf
   <property name="ca-postsave-command" type="s" access="read"/>
1495bf
   <property name="ca-postsave-uid" type="s" access="read"/>
1495bf
+  <property name="scep-cipher" type="s" access="readwrite"/>
1495bf
+  <property name="scep-digest" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-capabilities" type="as" access="read"/>
1495bf
   <property name="scep-ra-cert" type="s" access="read"/>
1495bf
@@ -693,6 +706,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
  </interface>
1495bf
 </node>
1495bf
 
1495bf
+[ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.get_config_file_path ]
1495bf
+$tmpdir/cas/20180327134236
1495bf
+
1495bf
 [ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.get_nickname ]
1495bf
 SelfSign
1495bf
 
1495bf
@@ -715,7 +731,7 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
 [ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.refresh ]
1495bf
 1
1495bf
 
1495bf
-/org/fedorahosted/certmonger/cas/CA2: warning: property org.fedorahosted.certmonger.ca.scep-ca-identifier not settable on this object
1495bf
+/org/fedorahosted/certmonger/cas/CA2: property org.fedorahosted.certmonger.ca.scep-cipher not set: (, x)
1495bf
 [ /org/fedorahosted/certmonger/cas/CA3: org.freedesktop.DBus.Introspectable.Introspect ]
1495bf
 
1495bf
 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
1495bf
@@ -748,6 +764,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   </signal>
1495bf
  </interface>
1495bf
  <interface name="org.fedorahosted.certmonger.ca">
1495bf
+  <method name="get_config_file_path">
1495bf
+   <arg name="path" type="s" direction="out"/>
1495bf
+  </method>
1495bf
   <method name="get_nickname">
1495bf
    <arg name="nickname" type="s" direction="out"/>
1495bf
   </method>
1495bf
@@ -792,6 +811,8 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   <property name="ca-presave-uid" type="s" access="read"/>
1495bf
   <property name="ca-postsave-command" type="s" access="read"/>
1495bf
   <property name="ca-postsave-uid" type="s" access="read"/>
1495bf
+  <property name="scep-cipher" type="s" access="readwrite"/>
1495bf
+  <property name="scep-digest" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-capabilities" type="as" access="read"/>
1495bf
   <property name="scep-ra-cert" type="s" access="read"/>
1495bf
@@ -800,6 +821,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
  </interface>
1495bf
 </node>
1495bf
 
1495bf
+[ /org/fedorahosted/certmonger/cas/CA3: org.fedorahosted.certmonger.ca.get_config_file_path ]
1495bf
+$tmpdir/cas/20180327134236-1
1495bf
+
1495bf
 [ /org/fedorahosted/certmonger/cas/CA3: org.fedorahosted.certmonger.ca.get_nickname ]
1495bf
 IPA
1495bf
 
1495bf
@@ -853,6 +877,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   </signal>
1495bf
  </interface>
1495bf
  <interface name="org.fedorahosted.certmonger.ca">
1495bf
+  <method name="get_config_file_path">
1495bf
+   <arg name="path" type="s" direction="out"/>
1495bf
+  </method>
1495bf
   <method name="get_nickname">
1495bf
    <arg name="nickname" type="s" direction="out"/>
1495bf
   </method>
1495bf
@@ -897,6 +924,8 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   <property name="ca-presave-uid" type="s" access="read"/>
1495bf
   <property name="ca-postsave-command" type="s" access="read"/>
1495bf
   <property name="ca-postsave-uid" type="s" access="read"/>
1495bf
+  <property name="scep-cipher" type="s" access="readwrite"/>
1495bf
+  <property name="scep-digest" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-capabilities" type="as" access="read"/>
1495bf
   <property name="scep-ra-cert" type="s" access="read"/>
1495bf
@@ -905,6 +934,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
  </interface>
1495bf
 </node>
1495bf
 
1495bf
+[ /org/fedorahosted/certmonger/cas/CA4: org.fedorahosted.certmonger.ca.get_config_file_path ]
1495bf
+$tmpdir/cas/20180327134236-2
1495bf
+
1495bf
 [ /org/fedorahosted/certmonger/cas/CA4: org.fedorahosted.certmonger.ca.get_nickname ]
1495bf
 certmaster
1495bf
 
1495bf
@@ -958,6 +990,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   </signal>
1495bf
  </interface>
1495bf
  <interface name="org.fedorahosted.certmonger.ca">
1495bf
+  <method name="get_config_file_path">
1495bf
+   <arg name="path" type="s" direction="out"/>
1495bf
+  </method>
1495bf
   <method name="get_nickname">
1495bf
    <arg name="nickname" type="s" direction="out"/>
1495bf
   </method>
1495bf
@@ -1002,6 +1037,8 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
   <property name="ca-presave-uid" type="s" access="read"/>
1495bf
   <property name="ca-postsave-command" type="s" access="read"/>
1495bf
   <property name="ca-postsave-uid" type="s" access="read"/>
1495bf
+  <property name="scep-cipher" type="s" access="readwrite"/>
1495bf
+  <property name="scep-digest" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-identifier" type="s" access="readwrite"/>
1495bf
   <property name="scep-ca-capabilities" type="as" access="read"/>
1495bf
   <property name="scep-ra-cert" type="s" access="read"/>
1495bf
@@ -1010,6 +1047,9 @@ dbus.Array([], signature=dbus.Signature('s'))
1495bf
  </interface>
1495bf
 </node>
1495bf
 
1495bf
+[ /org/fedorahosted/certmonger/cas/CA5: org.fedorahosted.certmonger.ca.get_config_file_path ]
1495bf
+$tmpdir/cas/20180327134236-3
1495bf
+
1495bf
 [ /org/fedorahosted/certmonger/cas/CA5: org.fedorahosted.certmonger.ca.get_nickname ]
1495bf
 dogtag-ipa-renew-agent
1495bf
 
1495bf
diff --git a/tests/033-scep/run.sh b/tests/033-scep/run.sh
1495bf
index 15480ac..f270a49 100755
1495bf
--- a/tests/033-scep/run.sh
1495bf
+++ b/tests/033-scep/run.sh
1495bf
@@ -103,7 +103,7 @@ check_nonce() {
1495bf
 	fi
1495bf
 }
1495bf
 
1495bf
-set_digest md5
1495bf
+set_digest sha256
1495bf
 $toolsdir/scepgen ca entry > scepdata
1495bf
 
1495bf
 echo "[req, no trust root]"
1495bf
@@ -135,7 +135,7 @@ grep ^gic: scepdata | cut -f2- -d: | base64 -i -d | $toolsdir/pk7verify -r mini.
1495bf
 check_failed
1495bf
 echo OK
1495bf
 echo "[req, old root]"
1495bf
-set_digest md5
1495bf
+set_digest sha256
1495bf
 $toolsdir/scepgen ca entry > scepdata
1495bf
 if test x`grep ^req: scepdata | cut -f2- -d:` = x ; then
1495bf
 	echo missing req
1495bf
@@ -145,7 +145,7 @@ check_verified
1495bf
 check_msgtype $SCEP_MSGTYPE_PKCSREQ
1495bf
 check_txid
1495bf
 check_nonce
1495bf
-check_digest md5
1495bf
+check_digest sha256
1495bf
 echo OK
1495bf
 echo "[gic, old trust root]"
1495bf
 set_digest sha1
1495bf
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
1495bf
index a0f7c2d..266ddc6 100755
1495bf
--- a/tests/run-tests.sh
1495bf
+++ b/tests/run-tests.sh
1495bf
@@ -77,7 +77,9 @@ for testid in "$@" $subdirs ; do
1495bf
 				if ! test -s "$i" ; then
1495bf
 					break
1495bf
 				fi
1495bf
-				if cmp -s "$tmpfile" "$i" 2> /dev/null ; then
1495bf
+				# This regex needs to be ignored since it is dynamically created at
1495bf
+				# every CA creation
1495bf
+				if diff -q -I "tmpdir/cas/[[:digit:]]\+" "$tmpfile" "$i" 2> /dev/null ; then
1495bf
 					stat=0
1495bf
 					echo "OK"
1495bf
 					cp $tmpfile "$builddir"/"$testid"/actual.out
1495bf
-- 
1495bf
1.8.3.1
1495bf