URL: https://github.com/freeipa/freeipa/pull/537
Author: Rezney
Title: #537: test_csrgen: adjusted comparison test scripts for CSRGenerator
Action: opened
PR body:
"""
Commit ada91c2 introduced changes in "csrgen/templates/openssl_base.tmpl"
which broke the following 2 tests:
test_CSRGenerator.test_userCert_OpenSSL
test_CSRGenerator.test_caIPAserviceCert_OpenSSL
The tests use files caIPAserviceCert_openssl.sh and userCert_openssl.sh
as expected scripts in order to compare scripts generated by CSRGenerator.
E.g. as other parameter was introduced we are now not checking with
"if [[ $# -ne 2 ]]" but rather with if "[[ $# -lt 2 ]]".
https://pagure.io/freeipa/issue/6724
"""
To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/537/head:pr537
git checkout pr537
From 4dc1dabc4fc687e8d21c5dc29e28a2718a9156dd Mon Sep 17 00:00:00 2001
From: Michal Reznik <[email protected]>
Date: Fri, 3 Mar 2017 11:17:17 +0100
Subject: [PATCH] test_csrgen: adjusted comparison test scripts for
CSRGenerator
Commit ada91c2 introduced changes in "csrgen/templates/openssl_base.tmpl"
which broke the following 2 tests:
test_CSRGenerator.test_userCert_OpenSSL
test_CSRGenerator.test_caIPAserviceCert_OpenSSL
The tests use files caIPAserviceCert_openssl.sh and userCert_openssl.sh
as expected scripts in order to compare scripts generated by CSRGenerator.
E.g. as other parameter was introduced we are now not checking with
"if [[ $# -ne 2 ]]" but rather with if "[[ $# -lt 2 ]]".
https://pagure.io/freeipa/issue/6724
---
.../data/test_csrgen/scripts/caIPAserviceCert_openssl.sh | 11 ++++++-----
.../data/test_csrgen/scripts/userCert_openssl.sh | 9 +++++----
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/ipatests/test_ipaclient/data/test_csrgen/scripts/caIPAserviceCert_openssl.sh b/ipatests/test_ipaclient/data/test_csrgen/scripts/caIPAserviceCert_openssl.sh
index c621a69..b59b9e6 100644
--- a/ipatests/test_ipaclient/data/test_csrgen/scripts/caIPAserviceCert_openssl.sh
+++ b/ipatests/test_ipaclient/data/test_csrgen/scripts/caIPAserviceCert_openssl.sh
@@ -1,14 +1,15 @@
#!/bin/bash -e
-if [[ $# -ne 2 ]]; then
-echo "Usage: $0 <outfile> <keyfile>"
+if [[ $# -lt 2 ]]; then
+echo "Usage: $0 <outfile> <keyfile> <other openssl arguments>"
echo "Called as: $0 $@"
exit 1
fi
CONFIG="$(mktemp)"
CSR="$1"
-shift
+KEYFILE="$2"
+shift; shift
echo \
'[ req ]
@@ -29,5 +30,5 @@ DNS = machine.example.com
subjectAltName = @sec1
' > "$CONFIG"
-openssl req -new -config "$CONFIG" -out "$CSR" -key $1
-rm "$CONFIG"
+openssl req -new -config "$CONFIG" -out "$CSR" -key "$KEYFILE" "$@"
+rm "$CONFIG"
\ No newline at end of file
diff --git a/ipatests/test_ipaclient/data/test_csrgen/scripts/userCert_openssl.sh b/ipatests/test_ipaclient/data/test_csrgen/scripts/userCert_openssl.sh
index cdbe8a1..2edf067 100644
--- a/ipatests/test_ipaclient/data/test_csrgen/scripts/userCert_openssl.sh
+++ b/ipatests/test_ipaclient/data/test_csrgen/scripts/userCert_openssl.sh
@@ -1,14 +1,15 @@
#!/bin/bash -e
-if [[ $# -ne 2 ]]; then
-echo "Usage: $0 <outfile> <keyfile>"
+if [[ $# -lt 2 ]]; then
+echo "Usage: $0 <outfile> <keyfile> <other openssl arguments>"
echo "Called as: $0 $@"
exit 1
fi
CONFIG="$(mktemp)"
CSR="$1"
-shift
+KEYFILE="$2"
+shift; shift
echo \
'[ req ]
@@ -29,5 +30,5 @@ email = [email protected]
subjectAltName = @sec1
' > "$CONFIG"
-openssl req -new -config "$CONFIG" -out "$CSR" -key $1
+openssl req -new -config "$CONFIG" -out "$CSR" -key "$KEYFILE" "$@"
rm "$CONFIG"
--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code