Browse code

Add object expiration test cases to run-tests

hrchu authored on 2014/03/31 00:56:58
Showing 1 changed files
... ...
@@ -535,6 +535,29 @@ test_s3cmd("Verify move", ['ls', '-r', pbucket(2)],
535 535
 test_s3cmd("Simple delete", ['del', '%s/xyz/etc2/Logo.PNG' % pbucket(1)],
536 536
     must_find = [ "File %s/xyz/etc2/Logo.PNG deleted" % pbucket(1) ])
537 537
 
538
+## ====== Create expiration rule with days and prefix
539
+test_s3cmd("Create expiration rule with days and prefix", ['expire', pbucket(1), '--expiry-days=365', '--expiry-prefix=log/'],
540
+    must_find = [ "Bucket '%s/': expiration configuration is set." % pbucket(1)])
541
+
542
+## ====== Create expiration rule with date and prefix
543
+test_s3cmd("Create expiration rule with date and prefix", ['expire', pbucket(1), '--expiry-date=2012-12-31T00:00:00.000Z', '--expiry-prefix=log/'],
544
+    must_find = [ "Bucket '%s/': expiration configuration is set." % pbucket(1)])
545
+
546
+## ====== Create expiration rule with days only
547
+test_s3cmd("Create expiration rule with days only", ['expire', pbucket(1), '--expiry-days=365'],
548
+    must_find = [ "Bucket '%s/': expiration configuration is set." % pbucket(1)])
549
+
550
+## ====== Create expiration rule with date only
551
+test_s3cmd("Create expiration rule with date only", ['expire', pbucket(1), '--expiry-date=2012-12-31T00:00:00.000Z'],
552
+    must_find = [ "Bucket '%s/': expiration configuration is set." % pbucket(1)])
553
+
554
+## ====== Get current expiration setting
555
+test_s3cmd("Get current expiration setting", ['info', pbucket(1)],
556
+    must_find = [ "Expiration Rule: all objects in this bucket will expire in '2012-12-31T00:00:00.000Z'"])
557
+
558
+## ====== Delete expiration rule
559
+test_s3cmd("Delete expiration rule", ['expire', pbucket(1)],
560
+    must_find = [ "Bucket '%s/': expiration configuration is deleted." % pbucket(1)])
538 561
 
539 562
 ## ====== Recursive delete maximum exceeed
540 563
 test_s3cmd("Recursive delete maximum exceeded", ['del', '--recursive', '--max-delete=1', '--exclude', 'Atomic*', '%s/xyz/etc' % pbucket(1)],
... ...
@@ -550,12 +573,10 @@ test_s3cmd("Recursive delete", ['del', '--recursive', '--exclude', 'Atomic*', '%
550 550
 test_s3cmd("Recursive delete all", ['del', '--recursive', '--force', pbucket(1)],
551 551
     must_find_re = [ "File .*binary/random-crap deleted" ])
552 552
 
553
-
554 553
 ## ====== Remove empty bucket
555 554
 test_s3cmd("Remove empty bucket", ['rb', pbucket(1)],
556 555
     must_find = [ "Bucket '%s/' removed" % pbucket(1) ])
557 556
 
558
-
559 557
 ## ====== Remove remaining buckets
560 558
 test_s3cmd("Remove remaining buckets", ['rb', '--recursive', pbucket(2), pbucket(3)],
561 559
     must_find = [ "Bucket '%s/' removed" % pbucket(2),