This is an automated email from the git hooks/post-receive script.
simo pushed a commit to branch master
in repository gssproxy.
commit 6e44a0d4e4df2d142260bfcfbfe9fc07d30408ae
Author: Robbie Harwood <rharwood(a)redhat.com>
Date: Wed Jan 18 19:37:36 2017 +0000
Raise failures in test suite
Also fix permissions on test files
Signed-off-by: Robbie Harwood <rharwood(a)redhat.com>
Reviewed-by: Simo Sorce <simo(a)redhat.com>
Merges #43
---
proxy/tests/runtests.py | 14 +++++++++++---
proxy/tests/t_acquire.py | 1 +
proxy/tests/t_basic.py | 5 +++++
proxy/tests/t_cred_store.py | 1 +
proxy/tests/t_impersonate.py | 29 +++++++++++++++++++++--------
proxy/tests/t_interpose.py | 1 +
proxy/tests/t_multi_key.py | 10 ++++++++--
proxy/tests/t_reloading.py | 19 +++++++++++++++----
8 files changed, 63 insertions(+), 17 deletions(-)
diff --git a/proxy/tests/runtests.py b/proxy/tests/runtests.py
index 1cd86ea..9b3625c 100755
--- a/proxy/tests/runtests.py
+++ b/proxy/tests/runtests.py
@@ -4,6 +4,7 @@
import argparse
import importlib
import signal
+import sys
import traceback
from testlib import *
@@ -16,7 +17,6 @@ def parse_args():
return vars(parser.parse_args())
if __name__ == '__main__':
-
args = parse_args()
testdir = args['path']
@@ -26,6 +26,8 @@ if __name__ == '__main__':
processes = dict()
+ errored = False
+
try:
wrapenv = setup_wrappers(testdir)
@@ -68,12 +70,18 @@ if __name__ == '__main__':
basicconf['prefix'] = '%02d' % testnum
logfile = os.path.join(testdir, "%02d_%s.log" % (testnum, fmod))
basicconf['logfile'] = open(logfile, 'a')
- t.run(testdir, gssapienv, basicconf)
- testnum += 1
+ r = t.run(testdir, gssapienv, basicconf)
+ if r != 0:
+ errored = True
+ testnum += 1
except Exception:
traceback.print_exc()
finally:
for name in processes:
print("Killing %s" % name)
os.killpg(processes[name].pid, signal.SIGTERM)
+
+ if errored:
+ sys.exit(1)
+ sys.exit(0)
diff --git a/proxy/tests/t_acquire.py b/proxy/tests/t_acquire.py
old mode 100644
new mode 100755
index b9edbba..813ac6d
--- a/proxy/tests/t_acquire.py
+++ b/proxy/tests/t_acquire.py
@@ -29,3 +29,4 @@ def run(testdir, env, conf, expected_failure=False):
# p1.returncode is set to None here
pass
print_return(p1.returncode, "Acquire", expected_failure)
+ return p1.returncode if not expected_failure else int(not p1.returncode)
diff --git a/proxy/tests/t_basic.py b/proxy/tests/t_basic.py
index faa13c3..b4f6f9f 100755
--- a/proxy/tests/t_basic.py
+++ b/proxy/tests/t_basic.py
@@ -54,3 +54,8 @@ def run(testdir, env, conf, expected_failure=False):
os.killpg(p2.pid, signal.SIGTERM)
except OSError:
pass
+ if p1.returncode != 0:
+ return p1.returncode if not expected_failure else int(not p1.returncode)
+ elif p2.returncode != 0:
+ return p2.returncode if not expected_failure else int(not p2.returncode)
+ return int(expected_failure)
diff --git a/proxy/tests/t_cred_store.py b/proxy/tests/t_cred_store.py
old mode 100644
new mode 100755
index fa0856c..76a5ad0
--- a/proxy/tests/t_cred_store.py
+++ b/proxy/tests/t_cred_store.py
@@ -38,3 +38,4 @@ def run(testdir, env, conf):
# p1.returncode is set to None here
pass
print_return(p1.returncode, "Cred store", False)
+ return p1.returncode
diff --git a/proxy/tests/t_impersonate.py b/proxy/tests/t_impersonate.py
index 9bfd2cd..42c801a 100755
--- a/proxy/tests/t_impersonate.py
+++ b/proxy/tests/t_impersonate.py
@@ -61,9 +61,9 @@ def run_cmd(testdir, env, conf, name, socket, cmd, expected_failure):
# p1.returncode is set to None here
pass
print_return(p1.returncode, name, expected_failure)
+ return p1.returncode if not expected_failure else int(not p1.returncode)
-
-def run(testdir, env, conf, expected_failure=False):
+def run(testdir, env, conf):
print("Testing impersonate creds...", file=sys.stderr)
path_prefix = os.path.join(testdir, 't' + conf['prefix'] +
'_')
@@ -74,40 +74,53 @@ def run(testdir, env, conf, expected_failure=False):
os.kill(conf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
+ rets = []
+
# Test all permitted
socket = os.path.join(testdir, 'impersonate.socket')
cmd = ["./tests/t_impersonate", USR_NAME, conf['svc_name']]
- run_cmd(testdir, env, conf, "Impersonate", socket, cmd, False)
+ r = run_cmd(testdir, env, conf, "Impersonate", socket, cmd, False)
+ rets.append(r)
#Test fail
socket = os.path.join(testdir, 'impersonate-proxyonly.socket')
cmd = ["./tests/t_impersonate", USR_NAME, conf['svc_name']]
- run_cmd(testdir, env, conf, "Impersonate fail self", socket, cmd, True)
+ r = run_cmd(testdir, env, conf, "Impersonate fail self", socket, cmd,
True)
+ rets.append(r)
#Test fail
socket = os.path.join(testdir, 'impersonate-selfonly.socket')
cmd = ["./tests/t_impersonate", USR_NAME, conf['svc_name']]
- run_cmd(testdir, env, conf, "Impersonate fail proxy", socket, cmd, True)
+ r = run_cmd(testdir, env, conf, "Impersonate fail proxy", socket, cmd,
True)
+ rets.append(r)
#Test s4u2self half succeed
socket = os.path.join(testdir, 'impersonate-selfonly.socket')
cmd = ["./tests/t_impersonate", USR_NAME, conf['svc_name'],
's4u2self',
path_prefix + 'impersonate-proxy.ccache']
- run_cmd(testdir, env, conf, "s4u2self delegation", socket, cmd, False)
+ r = run_cmd(testdir, env, conf, "s4u2self delegation", socket, cmd, False)
+ rets.append(r)
#Test s4u2proxy half fail
socket = os.path.join(testdir, 'impersonate-selfonly.socket')
cmd = ["./tests/t_impersonate", USR_NAME, PROXY_GSS, 's4u2proxy',
path_prefix + 'impersonate-proxy.ccache']
- run_cmd(testdir, env, conf, "s4u2proxy fail", socket, cmd, True)
+ r = run_cmd(testdir, env, conf, "s4u2proxy fail", socket, cmd, True)
+ rets.append(r)
#Test s4u2proxy half succeed
socket = os.path.join(testdir, 'impersonate-proxyonly.socket')
cmd = ["./tests/t_impersonate", USR_NAME, PROXY_GSS, 's4u2proxy',
path_prefix + 'impersonate-proxy.ccache']
- run_cmd(testdir, env, conf, "s4u2proxy", socket, cmd, False)
+ r = run_cmd(testdir, env, conf, "s4u2proxy", socket, cmd, False)
+ rets.append(r)
# Reset back gssproxy conf
update_gssproxy_conf(testdir, keysenv, GSSPROXY_CONF_TEMPLATE)
os.kill(conf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
+
+ e = [r for r in rets if r != 0]
+ if len(e) > 0:
+ return e[0]
+ return 0
diff --git a/proxy/tests/t_interpose.py b/proxy/tests/t_interpose.py
old mode 100644
new mode 100755
index 06a631b..b8a38fa
--- a/proxy/tests/t_interpose.py
+++ b/proxy/tests/t_interpose.py
@@ -25,3 +25,4 @@ def run(testdir, env, conf):
env=ienv)
itest.wait()
print_return(itest.returncode, "Interpose", False)
+ return itest.returncode
diff --git a/proxy/tests/t_multi_key.py b/proxy/tests/t_multi_key.py
old mode 100644
new mode 100755
index 8969cbb..3e78d1b
--- a/proxy/tests/t_multi_key.py
+++ b/proxy/tests/t_multi_key.py
@@ -34,7 +34,7 @@ def run(testdir, env, conf):
update_gssproxy_conf(testdir, p1env, GSSPROXY_MULTI_TEMPLATE)
os.kill(conf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
- run_basic_test(testdir, env, conf)
+ r1 = run_basic_test(testdir, env, conf)
print("Testing multiple keys Keytab with second principal",
file=sys.stderr)
@@ -49,4 +49,10 @@ def run(testdir, env, conf):
update_gssproxy_conf(testdir, p2env, GSSPROXY_MULTI_TEMPLATE)
os.kill(conf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
- run_basic_test(testdir, env, conf)
+ r2 = run_basic_test(testdir, env, conf)
+
+ if r1 != 0:
+ return r1
+ elif r2 != 0:
+ return r2
+ return 0
diff --git a/proxy/tests/t_reloading.py b/proxy/tests/t_reloading.py
index 30312f7..5933ce3 100755
--- a/proxy/tests/t_reloading.py
+++ b/proxy/tests/t_reloading.py
@@ -8,12 +8,15 @@ def run(testdir, env, basicconf):
prefix = basicconf['prefix']
keysenv = basicconf["keysenv"]
+ rets = []
+
print("Testing basic SIGHUP with no change", file=sys.stderr)
sys.stderr.write(" ")
basicconf['prefix'] += prefix + "_1"
os.kill(basicconf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
- run_basic_test(testdir, env, basicconf)
+ r = run_basic_test(testdir, env, basicconf)
+ rets.append(r)
print("Testing SIGHUP with dropped service", file=sys.stderr)
sys.stderr.write(" ")
@@ -21,7 +24,8 @@ def run(testdir, env, basicconf):
update_gssproxy_conf(testdir, keysenv, GSSPROXY_CONF_MINIMAL_TEMPLATE)
os.kill(basicconf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
- run_basic_test(testdir, env, basicconf, True)
+ r = run_basic_test(testdir, env, basicconf, True)
+ rets.append(r)
print("Testing SIGHUP with new service", file=sys.stderr)
sys.stderr.write(" ")
@@ -29,7 +33,8 @@ def run(testdir, env, basicconf):
update_gssproxy_conf(testdir, keysenv, GSSPROXY_CONF_TEMPLATE)
os.kill(basicconf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
- run_basic_test(testdir, env, basicconf)
+ r = run_basic_test(testdir, env, basicconf)
+ rets.append(r)
print("Testing SIGHUP with change of socket", file=sys.stderr)
sys.stderr.write(" ")
@@ -38,10 +43,16 @@ def run(testdir, env, basicconf):
env['GSSPROXY_SOCKET'] += "2"
os.kill(basicconf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
- run_basic_test(testdir, env, basicconf)
+ r = run_basic_test(testdir, env, basicconf)
+ rets.append(r)
# restore old configuration
env['GSSPROXY_SOCKET'] = env['GSSPROXY_SOCKET'][:-1]
update_gssproxy_conf(testdir, keysenv, GSSPROXY_CONF_TEMPLATE)
os.kill(basicconf["gpid"], signal.SIGHUP)
time.sleep(1) #Let gssproxy reload everything
+
+ e = [r for r in rets if r != 0]
+ if len(e) > 0:
+ return e[0]
+ return 0
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.