... | ... |
@@ -380,15 +380,38 @@ test_s3cmd("Invalid bucket name", ["mb", "--bucket-location=EU", pbucket('EU')], |
380 | 380 |
test_s3cmd("Buckets list", ["ls"], |
381 | 381 |
must_find = [ pbucket(1), pbucket(2), pbucket(3) ], must_not_find_re = pbucket('EU')) |
382 | 382 |
|
383 |
+## ====== Directory for cache |
|
384 |
+test_flushdir("Create cache dir", "testsuite/cachetest") |
|
383 | 385 |
|
384 | 386 |
## ====== Sync to S3 |
385 | 387 |
# Modified for Minio (exclude crappy dir) |
386 |
-test_s3cmd("Sync to S3", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings', '--exclude', 'crappy-file-name/*' ], |
|
387 |
- must_find = [ "ERROR: Upload of 'testsuite/permission-tests/permission-denied.txt' is not possible (Reason: Permission denied)", |
|
388 |
+test_s3cmd("Sync to S3", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings', '--exclude', 'crappy-file-name/*', '--exclude', 'testsuite/cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache'], |
|
389 |
+ must_find = ["ERROR: Upload of 'testsuite/permission-tests/permission-denied.txt' is not possible (Reason: Permission denied)", |
|
388 | 390 |
], |
389 |
- must_not_find_re = [ "demo/", "^(?!WARNING: Skipping).*\.png$", "permission-denied-dir" ], |
|
391 |
+ must_not_find_re = ["demo/", "^(?!WARNING: Skipping).*\.png$", "permission-denied-dir"], |
|
390 | 392 |
retcode = EX_PARTIAL) |
391 | 393 |
|
394 |
+## ====== Create new file and sync with caching enabled |
|
395 |
+test_mkdir("Create cache dir", "testsuite/cachetest/content") |
|
396 |
+with open("testsuite/cachetest/content/testfile", "w"): |
|
397 |
+ pass |
|
398 |
+ |
|
399 |
+test_s3cmd("Sync to S3 with caching", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings', '--exclude', 'crappy-file-name/*', '--exclude', 'cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache'], |
|
400 |
+ must_find = "upload: 'testsuite/cachetest/content/testfile' -> '%s/xyz/cachetest/content/testfile'" % pbucket(1), |
|
401 |
+ must_not_find = "upload 'testsuite/cachetest/.s3cmdcache'", |
|
402 |
+ retcode = EX_PARTIAL) |
|
403 |
+ |
|
404 |
+## ====== Remove content and retry cached sync with --delete-removed |
|
405 |
+test_rmdir("Remove local file", "testsuite/cachetest/content") |
|
406 |
+ |
|
407 |
+test_s3cmd("Sync to S3 and delete removed with caching", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings', '--exclude', 'crappy-file-name/*', '--exclude', 'testsuite/cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache', '--delete-removed'], |
|
408 |
+ must_find = "delete: '%s/xyz/cachetest/content/testfile'" % pbucket(1), |
|
409 |
+ must_not_find = "dictionary changed size during iteration", |
|
410 |
+ retcode = EX_PARTIAL) |
|
411 |
+ |
|
412 |
+## ====== Remove cache directory and file |
|
413 |
+test_rmdir("Remove cache dir", "testsuite/cachetest") |
|
414 |
+ |
|
392 | 415 |
if have_encoding: |
393 | 416 |
## ====== Sync UTF-8 / GBK / ... to S3 |
394 | 417 |
test_s3cmd(u"Sync %s to S3" % encoding, ['sync', 'testsuite/encodings/' + encoding, '%s/xyz/encodings/' % pbucket(1), '--exclude', 'demo/*', '--no-encrypt' ], |
... | ... |
@@ -378,33 +378,36 @@ test_s3cmd("Buckets list", ["ls"], |
378 | 378 |
must_find = [ pbucket(1), pbucket(2), pbucket(3) ], must_not_find_re = pbucket('EU')) |
379 | 379 |
|
380 | 380 |
## ====== Directory for cache |
381 |
-test_mkdir("Create cache dir","testsuite/cachetest/content") |
|
381 |
+test_flushdir("Create cache dir", "testsuite/cachetest") |
|
382 | 382 |
|
383 | 383 |
## ====== Sync to S3 |
384 |
-test_s3cmd("Sync to S3", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings','--exclude','testsuite/cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache' ], |
|
385 |
- must_find = [ "ERROR: Upload of 'testsuite/permission-tests/permission-denied.txt' is not possible (Reason: Permission denied)", |
|
386 |
- "WARNING: 32 non-printable characters replaced in: crappy-file-name/non-printables", |
|
384 |
+test_s3cmd("Sync to S3", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings', '--exclude', 'testsuite/cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache'], |
|
385 |
+ must_find = ["ERROR: Upload of 'testsuite/permission-tests/permission-denied.txt' is not possible (Reason: Permission denied)", |
|
386 |
+ "WARNING: 32 non-printable characters replaced in: crappy-file-name/non-printables", |
|
387 | 387 |
], |
388 |
- must_not_find_re = [ "demo/", "^(?!WARNING: Skipping).*\.png$", "permission-denied-dir" ], |
|
388 |
+ must_not_find_re = ["demo/", "^(?!WARNING: Skipping).*\.png$", "permission-denied-dir"], |
|
389 | 389 |
retcode = EX_PARTIAL) |
390 | 390 |
|
391 | 391 |
## ====== Create new file and sync with caching enabled |
392 |
-f = open("testsuite/cachetest/content/testfile","w") |
|
393 |
-f.close() |
|
394 |
-test_s3cmd("Sync to S3 with caching", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings','--exclude','cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache' ], |
|
392 |
+test_mkdir("Create cache dir", "testsuite/cachetest/content") |
|
393 |
+with open("testsuite/cachetest/content/testfile", "w"): |
|
394 |
+ pass |
|
395 |
+ |
|
396 |
+test_s3cmd("Sync to S3 with caching", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings', '--exclude', 'cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache' ], |
|
395 | 397 |
must_find = "upload: 'testsuite/cachetest/content/testfile' -> '%s/xyz/cachetest/content/testfile'" % pbucket(1), |
396 | 398 |
must_not_find = "upload 'testsuite/cachetest/.s3cmdcache'", |
397 | 399 |
retcode = EX_PARTIAL) |
398 | 400 |
|
399 | 401 |
## ====== Remove content and retry cached sync with --delete-removed |
400 |
-test_rmdir("Remove local file","testsuite/cachetest/content") |
|
401 |
-test_s3cmd("Sync to S3 and delete removed with caching", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings','--exclude','cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache', '--delete-removed' ], |
|
402 |
+test_rmdir("Remove local file", "testsuite/cachetest/content") |
|
403 |
+ |
|
404 |
+test_s3cmd("Sync to S3 and delete removed with caching", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings', '--exclude', 'testsuite/cachetest/.s3cmdcache', '--cache-file', 'testsuite/cachetest/.s3cmdcache', '--delete-removed'], |
|
402 | 405 |
must_find = "delete: '%s/xyz/cachetest/content/testfile'" % pbucket(1), |
403 | 406 |
must_not_find = "dictionary changed size during iteration", |
404 | 407 |
retcode = EX_PARTIAL) |
405 | 408 |
|
406 | 409 |
## ====== Remove cache directory and file |
407 |
-test_rmdir("Remove cache dir","testsuite/cachetest") |
|
410 |
+test_rmdir("Remove cache dir", "testsuite/cachetest") |
|
408 | 411 |
|
409 | 412 |
if have_encoding: |
410 | 413 |
## ====== Sync UTF-8 / GBK / ... to S3 |