URL: https://github.com/freeipa/freeipa/pull/380
Author: martbab
 Title: #380: Travis CI: actually return non-zero exit status when the test job 
fails
Action: opened

PR body:
"""
Thanks to @stlaz for catching this.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/380/head:pr380
git checkout pr380
From 1f6a7917a6ff69c6a3ca9ea29ebe5bb0d38786c4 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Mon, 9 Jan 2017 12:27:36 +0100
Subject: [PATCH 1/2] Travis CI: actually return non-zero exit status when the
 test job fails

The original code did not actually propagate the test runner exit status
to parent process so Travis CI job was always green.
---
 .travis_run_task.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.travis_run_task.sh b/.travis_run_task.sh
index 9fd1c1c..7d050b0 100755
--- a/.travis_run_task.sh
+++ b/.travis_run_task.sh
@@ -47,7 +47,11 @@ ipa-docker-test-runner -l $CI_RESULTS_LOG \
     --git-repo $TRAVIS_BUILD_DIR \
     $TASK_TO_RUN $test_set
 
-if $?
+exit_status="$?"
+
+if [[ "$exit_status" -ne 0 ]]
 then
     truncate_log_to_test_failures
 fi
+
+exit $exit_status

From bd5715a6a773d7bd9a59677988e8156460485310 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Mon, 9 Jan 2017 12:31:43 +0100
Subject: [PATCH 2/2] DO NOT PUSH: intentionally failing test for verification

---
 ipatests/test_ipaserver/test_kadmin.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipatests/test_ipaserver/test_kadmin.py b/ipatests/test_ipaserver/test_kadmin.py
index 1b38791..c7fb13b 100644
--- a/ipatests/test_ipaserver/test_kadmin.py
+++ b/ipatests/test_ipaserver/test_kadmin.py
@@ -86,7 +86,7 @@ def assert_success(self, command, *args):
         to catch the command's stderr and check that it is empty
         """
         result = command(*args)
-        assert not result.error_output
+        assert result.error_output
 
     def test_create_keytab(self, service, keytab):
         """
-- 
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