You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Fokko (via GitHub)" <gi...@apache.org> on 2023/01/30 20:44:29 UTC

[GitHub] [iceberg] Fokko commented on a diff in pull request #6703: Python: Fix warnings from pytest

Fokko commented on code in PR #6703:
URL: https://github.com/apache/iceberg/pull/6703#discussion_r1091126388


##########
python/tests/catalog/test_glue.py:
##########
@@ -67,7 +67,18 @@ def get_random_databases(n: int) -> Set[str]:
 
 @pytest.fixture(name="_bucket_initialize")
 def fixture_s3_bucket(_s3) -> None:  # type: ignore
-    _s3.create_bucket(Bucket=BUCKET_NAME)
+    bucket = _s3.create_bucket(Bucket=BUCKET_NAME)
+    yield bucket
+
+    response = _s3.list_objects_v2(
+        Bucket=BUCKET_NAME,
+    )
+    while response["KeyCount"] > 0:
+        _s3.delete_objects(Bucket=BUCKET_NAME, Delete={"Objects": [{"Key": obj["Key"]} for obj in response["Contents"]]})

Review Comment:
   I'm also no expert on the subject, but it looks like the max number of key returned is also 1000:
   <img width="776" alt="image" src="https://user-images.githubusercontent.com/1134248/215590530-0511132d-cc2a-474f-acbe-59b70bb8f736.png">
   From: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.list_objects_v2
   
   This will iterate until `KeyCount` is zero



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org