Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cdmtaskservice/s3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ async def _fnc_wrapper(self, client, func):
raise S3ClientConnectError(
"Access denied to list buckets on the s3 system"
) from e
# BAdDigest = CEPH, ChecksumMismatch = Minio
# BadDigest = CEPH, ChecksumMismatch = Minio
if code in ("XAmzContentChecksumMismatch", "BadDigest"):
raise S3ChecksumMismatchError(f"Checksum mismatch for upload to {path}")
logger.exception(
Expand Down
5 changes: 1 addition & 4 deletions test/controllers/minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from utils import find_free_port


class MinioController:
# adapted from https://github.com/kbase/java_test_utilities/blob/develop/src/main/java/us/kbase/testutils/controllers/minio/MinioController.java

Expand Down Expand Up @@ -94,10 +95,6 @@ async def create_bucket(self, bucket):
async with self.get_client() as client:
await client.create_bucket(Bucket=bucket)

async def get_object(self, bucket, key) -> dict[str, Any]:
async with self.get_client() as client:
return await client.get_object(Bucket=bucket, Key=key, ChecksumMode="ENABLED")

async def upload_file(
self,
path,
Expand Down
21 changes: 12 additions & 9 deletions test/s3/s3_remote_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,11 @@ async def test_upload_presigned_url(minio):
await upload_presigned_url(sess, url.url, url.fields, TEST_RAND10KB, timeout_sec=5)
with open(TEST_RAND10KB, "rb") as f:
expectedfile = f.read()
objdata = await minio.get_object("test-bucket", "foo/myfile")
body = await objdata["Body"].read()
async with minio.get_client() as client:
obj = await client.get_object(Bucket="test-bucket", Key="foo/myfile")
body = await obj["Body"].read()
assert body == expectedfile
assert objdata["ETag"] == '"3291fbb392f6fad06dbf331dfb74da81"'
assert obj["ETag"] == '"3291fbb392f6fad06dbf331dfb74da81"'


@pytest.mark.asyncio
Expand All @@ -245,17 +246,19 @@ async def test_upload_presigned_url_with_crc_and_insecure_ssl(minio):
S3Paths(["test-bucket/foo/myfile"]), ["4ekt2WB1KO4="]))[0]
async with aiohttp.ClientSession() as sess:
# There's not a lot to test with insecure ssl other than it doesn't break things
# Unless we want to get really crazy and set up Minio with a SSC in the tests. We don't
# Unless we want to get really crazy and set up S3 with a SSC in the tests. We don't
await upload_presigned_url(
sess, url.url, url.fields, TEST_RAND1KB, insecure_ssl=True, timeout_sec=5)
with open(TEST_RAND1KB, "rb") as f:
expectedfile = f.read()
objdata = await minio.get_object("test-bucket", "foo/myfile")

body = await objdata["Body"].read()
async with minio.get_client() as client:
obj = await client.get_object(
Bucket="test-bucket", Key="foo/myfile", ChecksumMode="ENABLED"
)
body = await obj["Body"].read()
assert body == expectedfile
assert objdata["ETag"] == '"b10278db14633f102103c5e9d75c0af0"'
assert objdata["ChecksumCRC64NVME"] == "4ekt2WB1KO4="
assert obj["ETag"] == '"b10278db14633f102103c5e9d75c0af0"'
assert obj["ChecksumCRC64NVME"] == "4ekt2WB1KO4="


@pytest.mark.asyncio
Expand Down
Loading