]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add a unit test simulating simultaneous checkouts
authorZack Cerza <zack@cerza.org>
Wed, 2 Jul 2014 16:08:48 +0000 (10:08 -0600)
committerZack Cerza <zack@cerza.org>
Wed, 2 Jul 2014 16:08:48 +0000 (10:08 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/test/test_repo_utils.py

index 9e94c1af0f6006ecc06df9feccc03ea2631341fc..0cb7b06022af1a6cfdeb1f8de1435257b0a881ad 100644 (file)
@@ -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)