##// END OF EJS Templates
test concurency script updates...
marcink -
r1666:a4040607 beta
parent child Browse files
Show More
@@ -54,6 +54,7 b' add_cache(conf)'
54 USER = 'test_admin'
54 USER = 'test_admin'
55 PASS = 'test12'
55 PASS = 'test12'
56 HOST = '127.0.0.1:5000'
56 HOST = '127.0.0.1:5000'
57 METHOD = 'pull'
57 DEBUG = True
58 DEBUG = True
58 log = logging.getLogger(__name__)
59 log = logging.getLogger(__name__)
59
60
@@ -153,9 +154,12 b' def get_anonymous_access():'
153 #==============================================================================
154 #==============================================================================
154 # TESTS
155 # TESTS
155 #==============================================================================
156 #==============================================================================
156 def test_clone_with_credentials(no_errors=False, repo=HG_REPO):
157 def test_clone_with_credentials(no_errors=False, repo=HG_REPO, method=METHOD,
158 seq=None):
157 cwd = path = jn(TESTS_TMP_PATH, repo)
159 cwd = path = jn(TESTS_TMP_PATH, repo)
158
160
161 if seq == None:
162 seq = _RandomNameSequence().next()
159
163
160 try:
164 try:
161 shutil.rmtree(path, ignore_errors=True)
165 shutil.rmtree(path, ignore_errors=True)
@@ -165,25 +169,38 b' def test_clone_with_credentials(no_error'
165 raise
169 raise
166
170
167
171
168 clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s %(dest)s' % \
172 clone_url = 'http://%(user)s:%(pass)s@%(host)s/%(cloned_repo)s' % \
169 {'user':USER,
173 {'user':USER,
170 'pass':PASS,
174 'pass':PASS,
171 'host':HOST,
175 'host':HOST,
172 'cloned_repo':repo,
176 'cloned_repo':repo, }
173 'dest':path + _RandomNameSequence().next()}
174
177
175 stdout, stderr = Command(cwd).execute('hg clone', clone_url)
178 dest = path + seq
179 if method == 'pull':
180 stdout, stderr = Command(cwd).execute('hg', method, '--cwd', dest, clone_url)
181 else:
182 stdout, stderr = Command(cwd).execute('hg', method, clone_url, dest)
176
183
177 if no_errors is False:
184 if no_errors is False:
178 assert """adding file changes""" in stdout, 'no messages about cloning'
185 assert """adding file changes""" in stdout, 'no messages about cloning'
179 assert """abort""" not in stderr , 'got error from clone'
186 assert """abort""" not in stderr , 'got error from clone'
180
187
181 if __name__ == '__main__':
188 if __name__ == '__main__':
182 try:
189 try:
183 create_test_user(force=False)
190 create_test_user(force=False)
191 seq = None
192 import time
184
193
194 if METHOD == 'pull':
195 seq = _RandomNameSequence().next()
196 test_clone_with_credentials(repo=sys.argv[1], method='clone',
197 seq=seq)
198 s = time.time()
185 for i in range(int(sys.argv[2])):
199 for i in range(int(sys.argv[2])):
186 test_clone_with_credentials(repo=sys.argv[1])
200 print 'take', i
187
201 test_clone_with_credentials(repo=sys.argv[1], method=METHOD,
202 seq=seq)
203 print 'time taken %.3f' % (time.time() - s)
188 except Exception, e:
204 except Exception, e:
205 raise
189 sys.exit('stop on %s' % e)
206 sys.exit('stop on %s' % e)
General Comments 0
You need to be logged in to leave comments. Login now