Browse code

Provide --bucket-prefix for run-tests.py

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/branches/amax-follow-symlinks@422 830e0280-6d2a-0410-9c65-932aecc39d9d

Aaron Maxwell authored on 2010/07/11 15:11:11
Showing 1 changed files
... ...
@@ -12,6 +12,14 @@ import re
12 12
 from subprocess import Popen, PIPE, STDOUT
13 13
 import locale
14 14
 
15
+# Set up options
16
+# from optparse import OptionParser
17
+# optparser = OptionParser()
18
+# optparser.add_option("-p", "--bucket-prefix", dest="bucket_prefix", default="",
19
+#                      help="Prefix for names of test buckets (to make them unique)")
20
+# (options, args) = optparser.parse_args()
21
+
22
+
15 23
 count_pass = 0
16 24
 count_fail = 0
17 25
 count_skip = 0
... ...
@@ -48,7 +56,7 @@ if not have_encoding and os.path.isfile('testsuite/encodings/%s.tar.gz' % encodi
48 48
 	have_encoding = os.path.isdir('testsuite/encodings/' + encoding)
49 49
 
50 50
 if have_encoding:
51
-	enc_base_remote = "s3://s3cmd-autotest-1/xyz/%s/" % encoding
51
+	#enc_base_remote = "%s/xyz/%s/" % (pbucket(1), encoding)
52 52
 	enc_pattern = patterns[encoding]
53 53
 else:
54 54
 	print encoding + " specific files not found."
... ...
@@ -170,6 +178,7 @@ def test_flushdir(label, dir_name):
170 170
 	test_rmdir(label + "(rm)", dir_name)
171 171
 	return test_mkdir(label + "(mk)", dir_name)
172 172
 
173
+bucket_prefix = ''
173 174
 argv = sys.argv[1:]
174 175
 while argv:
175 176
 	arg = argv.pop(0)
... ...
@@ -183,6 +192,13 @@ while argv:
183 183
 	if arg in ("-v", "--verbose"):
184 184
 		verbose = True
185 185
 		continue
186
+        if arg in ("-p", "--bucket-prefix"):
187
+                try:
188
+                        bucket_prefix = argv.pop(0)
189
+                except IndexError:
190
+                        print "Bucket prefix option must explicitly supply a bucket name prefix"
191
+                        sys.exit(0)
192
+                continue
186 193
 	if arg.find("..") >= 0:
187 194
 		range_idx = arg.find("..")
188 195
 		range_start = arg[:range_idx] or 0
... ...
@@ -196,66 +212,74 @@ while argv:
196 196
 if not run_tests:
197 197
 	run_tests = range(0, 999)
198 198
 
199
+# helper functions for generating bucket names
200
+def bucket(tail):
201
+        '''Test bucket name'''
202
+        return '%ss3cmd-autotest-%s' % (bucket_prefix, tail)
203
+def pbucket(tail):
204
+        '''Like bucket(), but prepends "s3://" for you'''
205
+        return 's3://' + bucket(tail)
206
+
199 207
 ## ====== Remove test buckets
200
-test_s3cmd("Remove test buckets", ['rb', '-r', 's3://s3cmd-autotest-1', 's3://s3cmd-autotest-2', 's3://s3cmd-Autotest-3'],
201
-	must_find = [ "Bucket 's3://s3cmd-autotest-1/' removed",
202
-		      "Bucket 's3://s3cmd-autotest-2/' removed",
203
-		      "Bucket 's3://s3cmd-Autotest-3/' removed" ])
208
+test_s3cmd("Remove test buckets", ['rb', '-r', pbucket(1), pbucket(2), pbucket(3)],
209
+	must_find = [ "Bucket '%s/' removed" % pbucket(1),
210
+		      "Bucket '%s/' removed" % pbucket(2),
211
+		      "Bucket '%s/' removed" % pbucket(3) ])
204 212
 
205 213
 
206 214
 ## ====== Create one bucket (EU)
207
-test_s3cmd("Create one bucket (EU)", ['mb', '--bucket-location=EU', 's3://s3cmd-autotest-1'], 
208
-	must_find = "Bucket 's3://s3cmd-autotest-1/' created")
215
+test_s3cmd("Create one bucket (EU)", ['mb', '--bucket-location=EU', pbucket(1)], 
216
+	must_find = "Bucket '%s/' created" % pbucket(1))
209 217
 
210 218
 
211 219
 
212 220
 ## ====== Create multiple buckets
213
-test_s3cmd("Create multiple buckets", ['mb', 's3://s3cmd-autotest-2', 's3://s3cmd-Autotest-3'], 
214
-	must_find = [ "Bucket 's3://s3cmd-autotest-2/' created", "Bucket 's3://s3cmd-Autotest-3/' created" ])
221
+test_s3cmd("Create multiple buckets", ['mb', pbucket(2), pbucket(3)], 
222
+	must_find = [ "Bucket '%s/' created" % pbucket(2), "Bucket '%s/' created" % pbucket(3)])
215 223
 
216 224
 
217 225
 ## ====== Invalid bucket name
218
-test_s3cmd("Invalid bucket name", ["mb", "--bucket-location=EU", "s3://s3cmd-Autotest-EU"], 
226
+test_s3cmd("Invalid bucket name", ["mb", "--bucket-location=EU", pbucket('EU')], 
219 227
 	retcode = 1,
220
-	must_find = "ERROR: Parameter problem: Bucket name 's3cmd-Autotest-EU' contains disallowed character", 
228
+	must_find = "ERROR: Parameter problem: Bucket name '%s' contains disallowed character" % bucket('EU'), 
221 229
 	must_not_find_re = "Bucket.*created")
222 230
 
223 231
 
224 232
 ## ====== Buckets list
225 233
 test_s3cmd("Buckets list", ["ls"], 
226
-	must_find = [ "autotest-1", "autotest-2", "Autotest-3" ], must_not_find_re = "Autotest-EU")
234
+	must_find = [ "autotest-1", "autotest-2", "autotest-3" ], must_not_find_re = "autotest-EU")
227 235
 
228 236
 
229 237
 ## ====== Sync to S3
230
-test_s3cmd("Sync to S3", ['sync', 'testsuite/', 's3://s3cmd-autotest-1/xyz/', '--exclude', '.svn/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings' ],
238
+test_s3cmd("Sync to S3", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', '.svn/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings' ],
231 239
 	must_find = [ "WARNING: 32 non-printable characters replaced in: crappy-file-name/too-crappy ^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_^? +-[\]^<>%%\"'#{}`&?.end",
232
-	              "stored as 's3://s3cmd-autotest-1/xyz/crappy-file-name/too-crappy ^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_^? +-[\\]^<>%%\"'#{}`&?.end'" ],
240
+	              "stored as '%s/xyz/crappy-file-name/too-crappy ^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_^? +-[\\]^<>%%%%\"'#{}`&?.end'" % pbucket(1) ],
233 241
 	must_not_find_re = [ "\.svn/", "\.png$" ])
234 242
 
235 243
 if have_encoding:
236 244
 	## ====== Sync UTF-8 / GBK / ... to S3
237
-	test_s3cmd("Sync %s to S3" % encoding, ['sync', 'testsuite/encodings/' + encoding, 's3://s3cmd-autotest-1/xyz/encodings/', '--exclude', '.svn/*', '--no-encrypt' ],
238
-		must_find = [ u"File 'testsuite/encodings/%(encoding)s/%(pattern)s' stored as 's3://s3cmd-autotest-1/xyz/encodings/%(encoding)s/%(pattern)s'" % { 'encoding' : encoding, 'pattern' : enc_pattern } ])
245
+	test_s3cmd("Sync %s to S3" % encoding, ['sync', 'testsuite/encodings/' + encoding, '%s/xyz/encodings/' % pbucket(1), '--exclude', '.svn/*', '--no-encrypt' ],
246
+		must_find = [ u"File 'testsuite/encodings/%(encoding)s/%(pattern)s' stored as '%(pbucket)s/xyz/encodings/%(encoding)s/%(pattern)s'" % { 'encoding' : encoding, 'pattern' : enc_pattern , 'pbucket' : pbucket(1)} ])
239 247
 
240 248
 
241 249
 ## ====== List bucket content
242
-must_find_re = [ u"DIR   s3://s3cmd-autotest-1/xyz/binary/$", u"DIR   s3://s3cmd-autotest-1/xyz/etc/$" ]
250
+must_find_re = [ u"DIR   %s/xyz/binary/$" % pbucket(1) , u"DIR   %s/xyz/etc/$" % pbucket(1) ]
243 251
 must_not_find = [ u"random-crap.md5", u".svn" ]
244
-test_s3cmd("List bucket content", ['ls', 's3://s3cmd-autotest-1/xyz/'],
252
+test_s3cmd("List bucket content", ['ls', '%s/xyz/' % pbucket(1) ],
245 253
 	must_find_re = must_find_re,
246 254
 	must_not_find = must_not_find)
247 255
 
248 256
 
249 257
 ## ====== List bucket recursive
250
-must_find = [ u"s3://s3cmd-autotest-1/xyz/binary/random-crap.md5" ]
258
+must_find = [ u"%s/xyz/binary/random-crap.md5" % pbucket(1) ]
251 259
 if have_encoding:
252
-	must_find.append(u"s3://s3cmd-autotest-1/xyz/encodings/%(encoding)s/%(pattern)s" % { 'encoding' : encoding, 'pattern' : enc_pattern })
253
-test_s3cmd("List bucket recursive", ['ls', '--recursive', 's3://s3cmd-autotest-1'],
260
+	must_find.append(u"%(pbucket)s/xyz/encodings/%(encoding)s/%(pattern)s" % { 'encoding' : encoding, 'pattern' : enc_pattern, 'pbucket' : pbucket(1) })
261
+test_s3cmd("List bucket recursive", ['ls', '--recursive', pbucket(1)],
254 262
 	must_find = must_find,
255 263
 	must_not_find = [ "logo.png" ])
256 264
 
257 265
 ## ====== FIXME
258
-# test_s3cmd("Recursive put", ['put', '--recursive', 'testsuite/etc', 's3://s3cmd-autotest-1/xyz/'])
266
+# test_s3cmd("Recursive put", ['put', '--recursive', 'testsuite/etc', '%s/xyz/' % pbucket(1) ])
259 267
 
260 268
 
261 269
 ## ====== Clean up local destination dir
... ...
@@ -263,10 +287,10 @@ test_flushdir("Clean testsuite-out/", "testsuite-out")
263 263
 
264 264
 
265 265
 ## ====== Sync from S3
266
-must_find = [ "File 's3://s3cmd-autotest-1/xyz/binary/random-crap.md5' stored as 'testsuite-out/xyz/binary/random-crap.md5'" ]
266
+must_find = [ "File '%s/xyz/binary/random-crap.md5' stored as 'testsuite-out/xyz/binary/random-crap.md5'" % pbucket(1) ]
267 267
 if have_encoding:
268
-	must_find.append(u"File 's3://s3cmd-autotest-1/xyz/encodings/%(encoding)s/%(pattern)s' stored as 'testsuite-out/xyz/encodings/%(encoding)s/%(pattern)s' " % { 'encoding' : encoding, 'pattern' : enc_pattern })
269
-test_s3cmd("Sync from S3", ['sync', 's3://s3cmd-autotest-1/xyz', 'testsuite-out'],
268
+	must_find.append(u"File '%(pbucket)s/xyz/encodings/%(encoding)s/%(pattern)s' stored as 'testsuite-out/xyz/encodings/%(encoding)s/%(pattern)s' " % { 'encoding' : encoding, 'pattern' : enc_pattern, 'pbucket' : pbucket(1) })
269
+test_s3cmd("Sync from S3", ['sync', '%s/xyz' % pbucket(1), 'testsuite-out'],
270 270
 	must_find = must_find)
271 271
 
272 272
 
... ...
@@ -275,61 +299,61 @@ test_flushdir("Clean testsuite-out/", "testsuite-out")
275 275
 
276 276
 
277 277
 ## ====== Put public, guess MIME
278
-test_s3cmd("Put public, guess MIME", ['put', '--guess-mime-type', '--acl-public', 'testsuite/etc/logo.png', 's3://s3cmd-autotest-1/xyz/etc/logo.png'],
279
-	must_find = [ "stored as 's3://s3cmd-autotest-1/xyz/etc/logo.png'" ])
278
+test_s3cmd("Put public, guess MIME", ['put', '--guess-mime-type', '--acl-public', 'testsuite/etc/logo.png', '%s/xyz/etc/logo.png' % pbucket(1)],
279
+	must_find = [ "stored as '%s/xyz/etc/logo.png'" % pbucket(1) ])
280 280
 
281 281
 
282 282
 ## ====== Retrieve from URL
283 283
 if have_wget:
284
-	test("Retrieve from URL", ['wget', '-O', 'testsuite-out/logo.png', 'http://s3cmd-autotest-1.s3.amazonaws.com/xyz/etc/logo.png'],
284
+	test("Retrieve from URL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.s3.amazonaws.com/xyz/etc/logo.png' % bucket(1)],
285 285
 		must_find_re = [ 'logo.png.*saved \[22059/22059\]' ])
286 286
 
287 287
 
288 288
 ## ====== Change ACL to Private
289
-test_s3cmd("Change ACL to Private", ['setacl', '--acl-private', 's3://s3cmd-autotest-1/xyz/etc/l*.png'],
289
+test_s3cmd("Change ACL to Private", ['setacl', '--acl-private', '%s/xyz/etc/l*.png' % pbucket(1)],
290 290
 	must_find = [ "logo.png: ACL set to Private" ])
291 291
 
292 292
 
293 293
 ## ====== Verify Private ACL
294 294
 if have_wget:
295
-	test("Verify Private ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://s3cmd-autotest-1.s3.amazonaws.com/xyz/etc/logo.png'],
295
+	test("Verify Private ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.s3.amazonaws.com/xyz/etc/logo.png' % bucket(1)],
296 296
 		retcode = 1,
297 297
 		must_find_re = [ 'ERROR 403: Forbidden' ])
298 298
 
299 299
 
300 300
 ## ====== Change ACL to Public
301
-test_s3cmd("Change ACL to Public", ['setacl', '--acl-public', '--recursive', 's3://s3cmd-autotest-1/xyz/etc/', '-v'],
301
+test_s3cmd("Change ACL to Public", ['setacl', '--acl-public', '--recursive', '%s/xyz/etc/' % pbucket(1) , '-v'],
302 302
 	must_find = [ "logo.png: ACL set to Public" ])
303 303
 
304 304
 
305 305
 ## ====== Verify Public ACL
306 306
 if have_wget:
307
-	test("Verify Public ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://s3cmd-autotest-1.s3.amazonaws.com/xyz/etc/logo.png'],
307
+	test("Verify Public ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.s3.amazonaws.com/xyz/etc/logo.png' % bucket(1)],
308 308
 		must_find_re = [ 'logo.png.*saved \[22059/22059\]' ])
309 309
 
310 310
 
311 311
 ## ====== Sync more to S3
312
-test_s3cmd("Sync more to S3", ['sync', 'testsuite/', 's3://s3cmd-autotest-1/xyz/', '--no-encrypt' ],
313
-	must_find = [ "File 'testsuite/.svn/entries' stored as 's3://s3cmd-autotest-1/xyz/.svn/entries' " ])
312
+test_s3cmd("Sync more to S3", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt' ],
313
+	must_find = [ "File 'testsuite/.svn/entries' stored as '%s/xyz/.svn/entries' " % pbucket(1) ])
314 314
 
315 315
 
316 316
 ## ====== Rename within S3
317
-test_s3cmd("Rename within S3", ['mv', 's3://s3cmd-autotest-1/xyz/etc/logo.png', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG'],
318
-	must_find = [ 'File s3://s3cmd-autotest-1/xyz/etc/logo.png moved to s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG' ])
317
+test_s3cmd("Rename within S3", ['mv', '%s/xyz/etc/logo.png' % pbucket(1), '%s/xyz/etc2/Logo.PNG' % pbucket(1)],
318
+	must_find = [ 'File %s/xyz/etc/logo.png moved to %s/xyz/etc2/Logo.PNG' % (pbucket(1), pbucket(1))])
319 319
 
320 320
 
321 321
 ## ====== Rename (NoSuchKey)
322
-test_s3cmd("Rename (NoSuchKey)", ['mv', 's3://s3cmd-autotest-1/xyz/etc/logo.png', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG'],
322
+test_s3cmd("Rename (NoSuchKey)", ['mv', '%s/xyz/etc/logo.png' % pbucket(1), '%s/xyz/etc2/Logo.PNG' % pbucket(1)],
323 323
 	retcode = 1,
324 324
 	must_find_re = [ 'ERROR:.*NoSuchKey' ],
325
-	must_not_find = [ 'File s3://s3cmd-autotest-1/xyz/etc/logo.png moved to s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG' ])
325
+	must_not_find = [ 'File %s/xyz/etc/logo.png moved to %s/xyz/etc2/Logo.PNG' % (pbucket(1), pbucket(1)) ])
326 326
 
327 327
 
328 328
 ## ====== Sync more from S3
329
-test_s3cmd("Sync more from S3", ['sync', '--delete-removed', 's3://s3cmd-autotest-1/xyz', 'testsuite-out'],
329
+test_s3cmd("Sync more from S3", ['sync', '--delete-removed', '%s/xyz' % pbucket(1), 'testsuite-out'],
330 330
 	must_find = [ "deleted: testsuite-out/logo.png",
331
-	              "File 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG' stored as 'testsuite-out/xyz/etc2/Logo.PNG' (22059 bytes", 
332
-	              "File 's3://s3cmd-autotest-1/xyz/.svn/entries' stored as 'testsuite-out/xyz/.svn/entries' " ],
331
+	              "File '%s/xyz/etc2/Logo.PNG' stored as 'testsuite-out/xyz/etc2/Logo.PNG' (22059 bytes" % pbucket(1), 
332
+	              "File '%s/xyz/.svn/entries' stored as 'testsuite-out/xyz/.svn/entries' " % pbucket(1) ],
333 333
 	must_not_find_re = [ "not-deleted.*etc/logo.png" ])
334 334
 
335 335
 
... ...
@@ -338,7 +362,7 @@ test_rmdir("Remove dst dir for get", "testsuite-out")
338 338
 
339 339
 
340 340
 ## ====== Get multiple files
341
-test_s3cmd("Get multiple files", ['get', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG', 's3://s3cmd-autotest-1/xyz/etc/AtomicClockRadio.ttf', 'testsuite-out'],
341
+test_s3cmd("Get multiple files", ['get', '%s/xyz/etc2/Logo.PNG' % pbucket(1), '%s/xyz/etc/AtomicClockRadio.ttf' % pbucket(1), 'testsuite-out'],
342 342
 	retcode = 1,
343 343
 	must_find = [ 'Destination must be a directory when downloading multiple sources.' ])
344 344
 
... ...
@@ -348,69 +372,69 @@ test_mkdir("Make dst dir for get", "testsuite-out")
348 348
 
349 349
 
350 350
 ## ====== Get multiple files
351
-test_s3cmd("Get multiple files", ['get', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG', 's3://s3cmd-autotest-1/xyz/etc/AtomicClockRadio.ttf', 'testsuite-out'],
351
+test_s3cmd("Get multiple files", ['get', '%s/xyz/etc2/Logo.PNG' % pbucket(1), '%s/xyz/etc/AtomicClockRadio.ttf' % pbucket(1), 'testsuite-out'],
352 352
 	must_find = [ u"saved as 'testsuite-out/Logo.PNG'", u"saved as 'testsuite-out/AtomicClockRadio.ttf'" ])
353 353
 
354 354
 ## ====== Upload files differing in capitalisation
355
-test_s3cmd("blah.txt / Blah.txt", ['put', '-r', 'testsuite/blahBlah', 's3://s3cmd-autotest-1/'],
356
-	must_find = [ 's3://s3cmd-autotest-1/blahBlah/Blah.txt', 's3://s3cmd-autotest-1/blahBlah/blah.txt' ])
355
+test_s3cmd("blah.txt / Blah.txt", ['put', '-r', 'testsuite/blahBlah', pbucket(1)],
356
+	must_find = [ '%s/blahBlah/Blah.txt' % pbucket(1), '%s/blahBlah/blah.txt' % pbucket(1)])
357 357
 
358 358
 ## ====== Copy between buckets
359
-test_s3cmd("Copy between buckets", ['cp', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG', 's3://s3cmd-Autotest-3/xyz/etc2/logo.png'],
360
-	must_find = [ "File s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG copied to s3://s3cmd-Autotest-3/xyz/etc2/logo.png" ])
359
+test_s3cmd("Copy between buckets", ['cp', '%s/xyz/etc2/Logo.PNG' % pbucket(1), '%s/xyz/etc2/logo.png' % pbucket(3)],
360
+	must_find = [ "File %s/xyz/etc2/Logo.PNG copied to %s/xyz/etc2/logo.png" % (pbucket(1), pbucket(3)) ])
361 361
 
362 362
 ## ====== Recursive copy
363
-test_s3cmd("Recursive copy, set ACL", ['cp', '-r', '--acl-public', 's3://s3cmd-autotest-1/xyz/', 's3://s3cmd-autotest-2/copy', '--exclude', '.svn/*', '--exclude', 'too-crappy*'],
364
-	must_find = [ "File s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG copied to s3://s3cmd-autotest-2/copy/etc2/Logo.PNG",
365
-	              "File s3://s3cmd-autotest-1/xyz/blahBlah/Blah.txt copied to s3://s3cmd-autotest-2/copy/blahBlah/Blah.txt",
366
-	              "File s3://s3cmd-autotest-1/xyz/blahBlah/blah.txt copied to s3://s3cmd-autotest-2/copy/blahBlah/blah.txt" ],
363
+test_s3cmd("Recursive copy, set ACL", ['cp', '-r', '--acl-public', '%s/xyz/' % pbucket(1), '%s/copy' % pbucket(2), '--exclude', '.svn/*', '--exclude', 'too-crappy*'],
364
+	must_find = [ "File %s/xyz/etc2/Logo.PNG copied to %s/copy/etc2/Logo.PNG" % (pbucket(1), pbucket(2)),
365
+	              "File %s/xyz/blahBlah/Blah.txt copied to %s/copy/blahBlah/Blah.txt" % (pbucket(1), pbucket(2)),
366
+	              "File %s/xyz/blahBlah/blah.txt copied to %s/copy/blahBlah/blah.txt" % (pbucket(1), pbucket(2)) ],
367 367
 	must_not_find = [ ".svn" ])
368 368
 
369 369
 ## ====== Verify ACL and MIME type
370
-test_s3cmd("Verify ACL and MIME type", ['info', 's3://s3cmd-autotest-2/copy/etc2/Logo.PNG' ],
370
+test_s3cmd("Verify ACL and MIME type", ['info', '%s/copy/etc2/Logo.PNG' % pbucket(2) ],
371 371
 	must_find_re = [ "MIME type:.*image/png", 
372 372
 	                 "ACL:.*\*anon\*: READ",
373
-					 "URL:.*http://s3cmd-autotest-2.s3.amazonaws.com/copy/etc2/Logo.PNG" ])
373
+					 "URL:.*http://%s.s3.amazonaws.com/copy/etc2/Logo.PNG" % bucket(2) ])
374 374
 
375 375
 ## ====== Multi source move
376
-test_s3cmd("Multi-source move", ['mv', '-r', 's3://s3cmd-autotest-2/copy/blahBlah/Blah.txt', 's3://s3cmd-autotest-2/copy/etc/', 's3://s3cmd-autotest-2/moved/'],
377
-	must_find = [ "File s3://s3cmd-autotest-2/copy/blahBlah/Blah.txt moved to s3://s3cmd-autotest-2/moved/Blah.txt",
378
-	              "File s3://s3cmd-autotest-2/copy/etc/AtomicClockRadio.ttf moved to s3://s3cmd-autotest-2/moved/AtomicClockRadio.ttf",
379
-				  "File s3://s3cmd-autotest-2/copy/etc/TypeRa.ttf moved to s3://s3cmd-autotest-2/moved/TypeRa.ttf" ],
376
+test_s3cmd("Multi-source move", ['mv', '-r', '%s/copy/blahBlah/Blah.txt' % pbucket(2), '%s/copy/etc/' % pbucket(2), '%s/moved/' % pbucket(2)],
377
+	must_find = [ "File %s/copy/blahBlah/Blah.txt moved to %s/moved/Blah.txt" % (pbucket(2), pbucket(2)),
378
+	              "File %s/copy/etc/AtomicClockRadio.ttf moved to %s/moved/AtomicClockRadio.ttf" % (pbucket(2), pbucket(2)),
379
+				  "File %s/copy/etc/TypeRa.ttf moved to %s/moved/TypeRa.ttf" % (pbucket(2), pbucket(2)) ],
380 380
 	must_not_find = [ "blah.txt" ])
381 381
 
382 382
 ## ====== Verify move
383
-test_s3cmd("Verify move", ['ls', '-r', 's3://s3cmd-autotest-2'],
384
-	must_find = [ "s3://s3cmd-autotest-2/moved/Blah.txt",
385
-	              "s3://s3cmd-autotest-2/moved/AtomicClockRadio.ttf",
386
-				  "s3://s3cmd-autotest-2/moved/TypeRa.ttf",
387
-				  "s3://s3cmd-autotest-2/copy/blahBlah/blah.txt" ],
388
-	must_not_find = [ "s3://s3cmd-autotest-2/copy/blahBlah/Blah.txt",
389
-					  "s3://s3cmd-autotest-2/copy/etc/AtomicClockRadio.ttf",
390
-					  "s3://s3cmd-autotest-2/copy/etc/TypeRa.ttf" ])
383
+test_s3cmd("Verify move", ['ls', '-r', pbucket(2)],
384
+	must_find = [ "%s/moved/Blah.txt" % pbucket(2),
385
+	              "%s/moved/AtomicClockRadio.ttf" % pbucket(2),
386
+				  "%s/moved/TypeRa.ttf" % pbucket(2),
387
+				  "%s/copy/blahBlah/blah.txt" % pbucket(2) ],
388
+	must_not_find = [ "%s/copy/blahBlah/Blah.txt" % pbucket(2),
389
+					  "%s/copy/etc/AtomicClockRadio.ttf" % pbucket(2),
390
+					  "%s/copy/etc/TypeRa.ttf" % pbucket(2) ])
391 391
 
392 392
 ## ====== Simple delete
393
-test_s3cmd("Simple delete", ['del', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG'],
394
-	must_find = [ "File s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG deleted" ])
393
+test_s3cmd("Simple delete", ['del', '%s/xyz/etc2/Logo.PNG' % pbucket(1)],
394
+	must_find = [ "File %s/xyz/etc2/Logo.PNG deleted" % pbucket(1) ])
395 395
 
396 396
 
397 397
 ## ====== Recursive delete
398
-test_s3cmd("Recursive delete", ['del', '--recursive', '--exclude', 'Atomic*', 's3://s3cmd-autotest-1/xyz/etc'],
399
-	must_find = [ "File s3://s3cmd-autotest-1/xyz/etc/TypeRa.ttf deleted" ],
398
+test_s3cmd("Recursive delete", ['del', '--recursive', '--exclude', 'Atomic*', '%s/xyz/etc' % pbucket(1)],
399
+	must_find = [ "File %s/xyz/etc/TypeRa.ttf deleted" % pbucket(1) ],
400 400
 	must_find_re = [ "File .*\.svn/entries deleted" ],
401 401
 	must_not_find = [ "AtomicClockRadio.ttf" ])
402 402
 
403 403
 ## ====== Recursive delete all
404
-test_s3cmd("Recursive delete all", ['del', '--recursive', '--force', 's3://s3cmd-autotest-1'],
404
+test_s3cmd("Recursive delete all", ['del', '--recursive', '--force', pbucket(1)],
405 405
 	must_find_re = [ "File .*binary/random-crap deleted" ])
406 406
 
407 407
 
408 408
 ## ====== Remove empty bucket
409
-test_s3cmd("Remove empty bucket", ['rb', 's3://s3cmd-autotest-1'],
410
-	must_find = [ "Bucket 's3://s3cmd-autotest-1/' removed" ])
409
+test_s3cmd("Remove empty bucket", ['rb', pbucket(1)],
410
+	must_find = [ "Bucket '%s/' removed" % pbucket(1) ])
411 411
 
412 412
 
413 413
 ## ====== Remove remaining buckets
414
-test_s3cmd("Remove remaining buckets", ['rb', '--recursive', 's3://s3cmd-autotest-2', 's3://s3cmd-Autotest-3'],
415
-	must_find = [ "Bucket 's3://s3cmd-autotest-2/' removed",
416
-		      "Bucket 's3://s3cmd-Autotest-3/' removed" ])
414
+test_s3cmd("Remove remaining buckets", ['rb', '--recursive', pbucket(2), pbucket(3)],
415
+	must_find = [ "Bucket '%s/' removed" % pbucket(2),
416
+		      "Bucket '%s/' removed" % pbucket(3) ])