URL: https://github.com/freeipa/freeipa/pull/1143
Author: Akasurde
 Title: #1143: [tests] Fix negative tests in CA-less testsuite
Action: opened

PR body:
"""
This fix adds check for non-existing files which are given
by negative testcases to copy from controller to system under tests.
This fixes test_nonexistent_ds_pkcs12_file and test_nonexistent_http_pkcs12_file
tests in CA-less testsuite.

Fixes: https://pagure.io/freeipa/issue/7182

Signed-off-by: Abhijeet Kasurde <akasu...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1143/head:pr1143
git checkout pr1143
From 2717838efc910c2e05a9b5c0d498f7839bc97e7a Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde <akasu...@redhat.com>
Date: Wed, 11 Oct 2017 10:58:35 +0530
Subject: [PATCH] [tests] Fix negative tests in CA-less testsuite

This fix adds check for non-existing files which are given
by negative testcases to copy from controller to system under tests.
This fixes test_nonexistent_ds_pkcs12_file and test_nonexistent_http_pkcs12_file
tests in CA-less testsuite.

Fixes: https://pagure.io/freeipa/issue/7182

Signed-off-by: Abhijeet Kasurde <akasu...@redhat.com>
---
 ipatests/test_integration/test_caless.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py
index 95c55fb8d9..6056fcdce2 100644
--- a/ipatests/test_integration/test_caless.py
+++ b/ipatests/test_integration/test_caless.py
@@ -266,9 +266,15 @@ def prepare_replica(self, _replica_number=0, replica=None, master=None,
         tasks.prepare_host(master)
         tasks.prepare_host(replica)
         for filename in set(files_to_copy):
+            filepath = os.path.join(self.cert_dir, filename)
+            if not os.path.exists(filepath):
+                # Negative tests passes non-existent file names,
+                # there is no point in copying them.
+                logger.info("File '%s' not found, copying to destination skipped", filepath)
+                continue
             try:
                 destination_host.transport.put_file(
-                    os.path.join(self.cert_dir, filename),
+                    filepath,
                     os.path.join(destination_host.config.test_dir, filename))
             except OSError:
                 pass
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to