From b8df7e40cccef3af16cb6827582414ad4f3fcd62 Mon Sep 17 00:00:00 2001 From: "Lincoln P. Thomas" Date: Wed, 18 Nov 2015 02:54:00 -0800 Subject: [PATCH] Fixing test_bucket_acl tests. https://github.com/eucalyptus/eutester/issues/377 --- eucaops/s3ops.py | 3 +- testcases/cloud_user/s3/bucket_tests.py | 55 ++++++++++++------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/eucaops/s3ops.py b/eucaops/s3ops.py index 24a43ba9..2367c90c 100644 --- a/eucaops/s3ops.py +++ b/eucaops/s3ops.py @@ -319,6 +319,7 @@ def get_canned_acl(self, canned_acl=None, bucket_owner_id=None, bucket_owner_dis built_acl.add_grant(Grant(permission="READ",type='Group',uri=self.s3_groups["authenticated_users"])) elif canned_acl == "log-delivery-write": built_acl.add_grant(Grant(permission="WRITE",type='Group',uri=self.s3_groups["log_delivery"])) + built_acl.add_grant(Grant(permission="READ_ACP",type='Group',uri=self.s3_groups["log_delivery"])) elif canned_acl == "bucket-owner-read": if bucket_owner_id is None: raise Exception("No bucket_owner_id passed when trying to create bucket-owner-read canned acl ") @@ -576,4 +577,4 @@ def show_buckets(self, buckets=None, format_size=True, printme=True): if printme: self.debug("\n{0}\n".format(str(main_table))) else: - return main_table \ No newline at end of file + return main_table diff --git a/testcases/cloud_user/s3/bucket_tests.py b/testcases/cloud_user/s3/bucket_tests.py index 542dd632..b997245d 100755 --- a/testcases/cloud_user/s3/bucket_tests.py +++ b/testcases/cloud_user/s3/bucket_tests.py @@ -160,35 +160,34 @@ def test_bucket_acl(self): owner_id = policy.acl.grants[0].id #upload a new acl for the bucket - new_acl = policy - new_user_display_name = owner_display_name - new_user_id = owner_id - new_acl.acl.add_user_grant(permission="READ", user_id=new_user_id, display_name=new_user_display_name) - try: - acl_bucket.set_acl(new_acl) - acl_check = acl_bucket.get_acl() - except S3ResponseError: - self.fail("Failed to set or get new acl") - - self.tester.info( "Got ACL: " + acl_check.acl.to_xml() ) - - #expected_result_base=' - # - #' + owner_id + ''+ owner_display_name + 'FULL_CONTROL - #EXPECTED_IDEXPECTED_NAMEREAD - #' - - if acl_check == None or not self.tester.check_acl_equivalence(acl1=acl_check.acl, acl2=new_acl.acl): - self.tester.s3.delete_bucket(test_bucket) - self.fail("Incorrect acl length or acl not found\n. Got bucket ACL:\n" + acl_check.acl.to_xml() + "\nExpected:" + new_acl.acl.to_xml()) - else: - self.tester.info("Got expected basic ACL addition") - - self.tester.info( "Grants 0 and 1: " + acl_check.acl.grants[0].to_xml() + " -- " + acl_check.acl.grants[1].to_xml() ) + # Commented out this test because Euca, AWS West, and AWS East + # all update the grants differently. + # Regardless, nothing changes functionally, owner always retains full control. + # So it's not a very useful test anyway. + #new_acl = policy + #new_user_display_name = owner_display_name + #new_user_id = owner_id + #new_acl.acl.add_user_grant(permission="READ", user_id=new_user_id, display_name=new_user_display_name) + #try: + # acl_bucket.set_acl(new_acl) + # acl_check = acl_bucket.get_acl() + #except S3ResponseError: + # self.fail("Failed to set or get new acl") + # + #self.tester.info( "Got ACL: " + acl_check.acl.to_xml() ) + # + #if acl_check == None or not self.tester.check_acl_equivalence(acl1=acl_check.acl, acl2=new_acl.acl): + # self.tester.s3.delete_bucket(test_bucket) + # self.fail("Incorrect acl length or acl not found\n. Got bucket ACL:\n" + acl_check.acl.to_xml() + "\nExpected:" + new_acl.acl.to_xml()) + #else: + # self.tester.info("Got expected basic ACL addition") + # + #self.tester.info( "Grants 0 and 1: " + acl_check.acl.grants[0].to_xml() + " -- " + acl_check.acl.grants[1].to_xml() ) #Check each canned ACL string in boto to make sure Walrus does it right for acl in boto.s3.acl.CannedACLStrings: - if acl == "authenticated-read": + #The bucket-owner-* canned ACLs apply only to objects, not buckets + if acl == "bucket-owner-read" or acl == "bucket-owner-full-control": continue self.tester.info('Testing canned acl: ' + acl) try: @@ -595,7 +594,7 @@ def clean_method(self): testcase = BucketTestSuite() ### Either use the list of tests passed from config/command line to determine what subset of tests to run list = testcase.args.tests or [ 'test_bucket_get_put_delete', \ - #'test_bucket_acl', \ FAILING AS OF 3.3.1 + 'test_bucket_acl', \ 'test_bucket_key_list_delim_prefix', \ 'test_bucket_key_listing_paging', \ 'test_bucket_location', \ @@ -607,4 +606,4 @@ def clean_method(self): ### Run the EutesterUnitTest objects result = testcase.run_test_case_list(unit_list,clean_on_exit=True) - exit(result) \ No newline at end of file + exit(result)