|
|
bb7cd1 |
From 7930ee12093eae1e1ab9422c4f4f9f8c5661fcb9 Mon Sep 17 00:00:00 2001
|
|
|
bb7cd1 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
bb7cd1 |
Date: Tue, 23 May 2017 13:55:01 +0200
|
|
|
bb7cd1 |
Subject: [PATCH 137/138] TESTS: Add a test for parallel execution of klist
|
|
|
bb7cd1 |
MIME-Version: 1.0
|
|
|
bb7cd1 |
Content-Type: text/plain; charset=UTF-8
|
|
|
bb7cd1 |
Content-Transfer-Encoding: 8bit
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Integration test for:
|
|
|
bb7cd1 |
https://pagure.io/SSSD/sssd/issue/3372
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
With https://pagure.io/SSSD/sssd/issue/3372 still broken, the unit test
|
|
|
bb7cd1 |
wold fail because one of the concurrent klist commands would trigger a
|
|
|
bb7cd1 |
race condition in the KCM queue code, crashing the KCM responder.
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
bb7cd1 |
(cherry picked from commit 274489b092bba5fc81cb0f803843d56b267c5aaf)
|
|
|
bb7cd1 |
---
|
|
|
bb7cd1 |
src/tests/intg/krb5utils.py | 6 +++++-
|
|
|
bb7cd1 |
src/tests/intg/test_kcm.py | 22 ++++++++++++++++++++++
|
|
|
bb7cd1 |
2 files changed, 27 insertions(+), 1 deletion(-)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/tests/intg/krb5utils.py b/src/tests/intg/krb5utils.py
|
|
|
bb7cd1 |
index 775cffd0bbfa011f2d8ffc1169dccfef96d78fab..0349ff3829533088fb2263f84b19574127d6e809 100644
|
|
|
bb7cd1 |
--- a/src/tests/intg/krb5utils.py
|
|
|
bb7cd1 |
+++ b/src/tests/intg/krb5utils.py
|
|
|
bb7cd1 |
@@ -36,7 +36,7 @@ class Krb5Utils(object):
|
|
|
bb7cd1 |
def __init__(self, krb5_conf_path):
|
|
|
bb7cd1 |
self.krb5_conf_path = krb5_conf_path
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
- def _run_in_env(self, args, stdin=None, extra_env=None):
|
|
|
bb7cd1 |
+ def spawn_in_env(self, args, stdin=None, extra_env=None):
|
|
|
bb7cd1 |
my_env = os.environ
|
|
|
bb7cd1 |
my_env['KRB5_CONFIG'] = self.krb5_conf_path
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
@@ -50,6 +50,10 @@ class Krb5Utils(object):
|
|
|
bb7cd1 |
stdin=subprocess.PIPE,
|
|
|
bb7cd1 |
stdout=subprocess.PIPE,
|
|
|
bb7cd1 |
stderr=subprocess.PIPE)
|
|
|
bb7cd1 |
+ return cmd
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ def _run_in_env(self, args, stdin=None, extra_env=None):
|
|
|
bb7cd1 |
+ cmd = self.spawn_in_env(args, stdin, extra_env)
|
|
|
bb7cd1 |
out, err = cmd.communicate(stdin)
|
|
|
bb7cd1 |
return cmd.returncode, out.decode('utf-8'), err.decode('utf-8')
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/tests/intg/test_kcm.py b/src/tests/intg/test_kcm.py
|
|
|
bb7cd1 |
index 11f80a1803b4ad9b8e8857bf9a8a244d4816f0a2..1ab2a1837687a6c2cf8676124b42538833550c91 100644
|
|
|
bb7cd1 |
--- a/src/tests/intg/test_kcm.py
|
|
|
bb7cd1 |
+++ b/src/tests/intg/test_kcm.py
|
|
|
bb7cd1 |
@@ -445,3 +445,25 @@ def test_kcm_sec_kdestroy_nocache(setup_for_kcm_sec,
|
|
|
bb7cd1 |
setup_secrets):
|
|
|
bb7cd1 |
testenv = setup_for_kcm_sec
|
|
|
bb7cd1 |
exercise_subsidiaries(testenv)
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+def test_kcm_sec_parallel_klist(setup_for_kcm_sec,
|
|
|
bb7cd1 |
+ setup_secrets):
|
|
|
bb7cd1 |
+ """
|
|
|
bb7cd1 |
+ Test that parallel operations from a single UID are handled well.
|
|
|
bb7cd1 |
+ Regression test for https://pagure.io/SSSD/sssd/issue/3372
|
|
|
bb7cd1 |
+ """
|
|
|
bb7cd1 |
+ testenv = setup_for_kcm_sec
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ testenv.k5kdc.add_principal("alice", "alicepw")
|
|
|
bb7cd1 |
+ out, _, _ = testenv.k5util.kinit("alice", "alicepw")
|
|
|
bb7cd1 |
+ assert out == 0
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ processes = []
|
|
|
bb7cd1 |
+ for i in range(0,10):
|
|
|
bb7cd1 |
+ p = testenv.k5util.spawn_in_env(['klist', '-A'])
|
|
|
bb7cd1 |
+ processes.append(p)
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ for p in processes:
|
|
|
bb7cd1 |
+ rc = p.wait()
|
|
|
bb7cd1 |
+ assert rc == 0
|
|
|
bb7cd1 |
--
|
|
|
bb7cd1 |
2.9.4
|
|
|
bb7cd1 |
|