##// END OF EJS Templates
made concurrency test also for git
marcink -
r2895:f5dc0417 beta
parent child Browse files
Show More
@@ -46,15 +46,15 b' from rhodecode.lib.auth import get_crypt'
46 from rhodecode.tests import TESTS_TMP_PATH, NEW_HG_REPO, HG_REPO
46 from rhodecode.tests import TESTS_TMP_PATH, NEW_HG_REPO, HG_REPO
47 from rhodecode.config.environment import load_environment
47 from rhodecode.config.environment import load_environment
48
48
49 rel_path = dn(dn(dn(os.path.abspath(__file__))))
49 rel_path = dn(dn(dn(dn(os.path.abspath(__file__)))))
50 conf = appconfig('config:development.ini', relative_to=rel_path)
50 conf = appconfig('config:rc.ini', relative_to=rel_path)
51 load_environment(conf.global_conf, conf.local_conf)
51 load_environment(conf.global_conf, conf.local_conf)
52
52
53 add_cache(conf)
53 add_cache(conf)
54
54
55 USER = 'test_admin'
55 USER = 'test_admin'
56 PASS = 'test12'
56 PASS = 'test12'
57 HOST = 'hg.local'
57 HOST = 'rc.local'
58 METHOD = 'pull'
58 METHOD = 'pull'
59 DEBUG = True
59 DEBUG = True
60 log = logging.getLogger(__name__)
60 log = logging.getLogger(__name__)
@@ -158,7 +158,7 b' def get_anonymous_access():'
158 # TESTS
158 # TESTS
159 #==============================================================================
159 #==============================================================================
160 def test_clone_with_credentials(no_errors=False, repo=HG_REPO, method=METHOD,
160 def test_clone_with_credentials(no_errors=False, repo=HG_REPO, method=METHOD,
161 seq=None):
161 seq=None, backend='hg'):
162 cwd = path = jn(TESTS_TMP_PATH, repo)
162 cwd = path = jn(TESTS_TMP_PATH, repo)
163
163
164 if seq == None:
164 if seq == None:
@@ -179,13 +179,16 b' def test_clone_with_credentials(no_error'
179
179
180 dest = path + seq
180 dest = path + seq
181 if method == 'pull':
181 if method == 'pull':
182 stdout, stderr = Command(cwd).execute('hg', method, '--cwd', dest, clone_url)
182 stdout, stderr = Command(cwd).execute(backend, method, '--cwd', dest, clone_url)
183 else:
183 else:
184 stdout, stderr = Command(cwd).execute('hg', method, clone_url, dest)
184 stdout, stderr = Command(cwd).execute(backend, method, clone_url, dest)
185
185 print stdout,'sdasdsadsa'
186 if no_errors is False:
186 if no_errors is False:
187 if backend == 'hg':
187 assert """adding file changes""" in stdout, 'no messages about cloning'
188 assert """adding file changes""" in stdout, 'no messages about cloning'
188 assert """abort""" not in stderr , 'got error from clone'
189 assert """abort""" not in stderr , 'got error from clone'
190 elif backend == 'git':
191 assert """Cloning into""" in stdout, 'no messages about cloning'
189
192
190 if __name__ == '__main__':
193 if __name__ == '__main__':
191 try:
194 try:
@@ -198,15 +201,20 b" if __name__ == '__main__':"
198 except:
201 except:
199 pass
202 pass
200
203
204 try:
205 backend = sys.argv[4]
206 except:
207 backend = 'hg'
208
201 if METHOD == 'pull':
209 if METHOD == 'pull':
202 seq = _RandomNameSequence().next()
210 seq = _RandomNameSequence().next()
203 test_clone_with_credentials(repo=sys.argv[1], method='clone',
211 test_clone_with_credentials(repo=sys.argv[1], method='clone',
204 seq=seq)
212 seq=seq, backend=backend)
205 s = time.time()
213 s = time.time()
206 for i in range(1, int(sys.argv[2]) + 1):
214 for i in range(1, int(sys.argv[2]) + 1):
207 print 'take', i
215 print 'take', i
208 test_clone_with_credentials(repo=sys.argv[1], method=METHOD,
216 test_clone_with_credentials(repo=sys.argv[1], method=METHOD,
209 seq=seq)
217 seq=seq, backend=backend)
210 print 'time taken %.3f' % (time.time() - s)
218 print 'time taken %.3f' % (time.time() - s)
211 except Exception, e:
219 except Exception, e:
212 raise
220 raise
General Comments 0
You need to be logged in to leave comments. Login now