URL: https://github.com/freeipa/freeipa/pull/538
Author: tiran
 Title: #538: Run test_ipaclient test suite
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/538/head:pr538
git checkout pr538
From 4dc1dabc4fc687e8d21c5dc29e28a2718a9156dd Mon Sep 17 00:00:00 2001
From: Michal Reznik <mrez...@redhat.com>
Date: Fri, 3 Mar 2017 11:17:17 +0100
Subject: [PATCH 1/2] 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 = testu...@example.com
 subjectAltName = @sec1
 ' > "$CONFIG"
 
-openssl req -new -config "$CONFIG" -out "$CSR" -key $1
+openssl req -new -config "$CONFIG" -out "$CSR" -key "$KEYFILE" "$@"
 rm "$CONFIG"

From e76000825a599b251fabc58c20e4f5184d9464e3 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Fri, 3 Mar 2017 12:57:21 +0100
Subject: [PATCH 2/2] Run test_ipaclient test suite

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index 04b766b..1a8f1b3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,6 +21,7 @@ env:
         - TASK_TO_RUN="run-tests"
           TESTS_TO_RUN="test_cmdline
             test_install
+            test_ipaclient
             test_ipalib
             test_ipapython
             test_ipaserver
-- 
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

Reply via email to