-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for s3 multipart checksums (#4991)
- Loading branch information
1 parent
e16594d
commit a8a2601
Showing
5 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,6 +179,9 @@ | |
}, | ||
"_value": { | ||
"type": "keyword" | ||
}, | ||
"_numberOfParts": { | ||
"type": "long" | ||
} | ||
} | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...h/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/s3/HeadObjectSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.operations.s3 | ||
|
||
import ch.epfl.bluebrain.nexus.delta.plugins.storage.files.model.Digest | ||
import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.model.DigestAlgorithm | ||
import ch.epfl.bluebrain.nexus.testkit.mu.NexusSuite | ||
import software.amazon.awssdk.services.s3.model.HeadObjectResponse | ||
|
||
class HeadObjectSuite extends NexusSuite { | ||
|
||
test("HeadObject should correctly parse a standard S3 SHA256 digest") { | ||
|
||
val multiPartDigest = "44ImQwqlEWtD75zMbO3GeJCOj4oO2lMb+VW6l6zJ3sc=" | ||
val response = | ||
HeadObjectResponse.builder().checksumSHA256(multiPartDigest).build() | ||
val digest = HeadObject(response).digest | ||
|
||
assertEquals( | ||
digest, | ||
Digest.ComputedDigest( | ||
DigestAlgorithm.SHA256, | ||
"e38226430aa5116b43ef9ccc6cedc678908e8f8a0eda531bf955ba97acc9dec7" | ||
) | ||
) | ||
|
||
} | ||
|
||
test("HeadObject should correctly parse a multipart S3 SHA256 digest") { | ||
val multiPartDigest = "kFsM2p15+Jbp2K0FIF0y1zIWlEJOt5052qlU8IRQPtM=-13" | ||
val response = | ||
HeadObjectResponse.builder().checksumSHA256(multiPartDigest).build() | ||
val digest = HeadObject(response).digest | ||
|
||
assertEquals( | ||
digest, | ||
Digest.MultiPartDigest( | ||
DigestAlgorithm.SHA256, | ||
"905b0cda9d79f896e9d8ad05205d32d7321694424eb79d39daa954f084503ed3", | ||
13 | ||
) | ||
) | ||
|
||
} | ||
|
||
} |