From cb7fdfb73f4d20a895407b2a796035ad59894fdb Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 2 Jul 2014 10:08:48 -0600 Subject: [PATCH] Add a unit test simulating simultaneous checkouts Signed-off-by: Zack Cerza --- teuthology/test/test_repo_utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/teuthology/test/test_repo_utils.py b/teuthology/test/test_repo_utils.py index 9e94c1af0f600..0cb7b06022af1 100644 --- a/teuthology/test/test_repo_utils.py +++ b/teuthology/test/test_repo_utils.py @@ -5,6 +5,7 @@ import shutil import subprocess from .. import repo_utils +from .. import parallel repo_utils.log.setLevel(logging.WARNING) @@ -108,3 +109,13 @@ class TestRepoUtils(object): def test_enforce_invalid_branch(self): with raises(ValueError): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'a b') + + def test_simultaneous_access(self): + count = 5 + with parallel.parallel() as p: + for i in range(count): + print "starting %s" % i + p.spawn(repo_utils.enforce_repo_state, self.repo_url, + self.dest_path, 'master') + for result in p: + print "result %s %s" % (i, result) -- 2.39.5