diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2fddd4604..7a2527177 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -45,6 +45,9 @@ jobs:
shell: bash
- name: Test
+ env:
+ AWS_RETRY_MODE: adaptive
+ AWS_MAX_ATTEMPTS: '5'
run: |
export AWS_S3EC_TEST_ALT_KMS_KEY_ARN=arn:aws:kms:${{ vars.CI_AWS_REGION }}:${{ secrets.CI_AWS_ACCOUNT_ID }}:key/${{ vars.CI_ALT_KMS_KEY_ID }}
export AWS_S3EC_TEST_ALT_ROLE_ARN=arn:aws:iam::${{ secrets.CI_AWS_ACCOUNT_ID }}:role/service-role/${{ vars.CI_ALT_ROLE }}
diff --git a/pom.xml b/pom.xml
index 71d4e6344..de793bbb9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,6 +120,12 @@
+
+ org.junit-pioneer
+ junit-pioneer
+ 1.9.1
+ test
+
org.mockito
mockito-core
diff --git a/src/test/java/software/amazon/encryption/s3/AdditionalDecryptionKeyMaterialTest.java b/src/test/java/software/amazon/encryption/s3/AdditionalDecryptionKeyMaterialTest.java
index 67a855135..1192fa008 100644
--- a/src/test/java/software/amazon/encryption/s3/AdditionalDecryptionKeyMaterialTest.java
+++ b/src/test/java/software/amazon/encryption/s3/AdditionalDecryptionKeyMaterialTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.services.s3.S3Client;
@@ -65,7 +65,7 @@ public static void setUp() throws NoSuchAlgorithmException {
* Test AES keyring with null additionalDecryptionKeyMaterial map.
* This tests the default behavior when no additional key material is provided.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithNullAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("aes-null-additional-key-material");
final String input = "AES with null additional key material";
@@ -129,7 +129,7 @@ public void testAesKeyringWithNullAdditionalKeyMaterial() {
* Test AES keyring with empty additionalDecryptionKeyMaterial map.
* This tests the behavior when an empty map is provided.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithEmptyAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("aes-empty-additional-key-material");
final String input = "AES with empty additional key material";
@@ -194,7 +194,7 @@ public void testAesKeyringWithEmptyAdditionalKeyMaterial() {
* Test AES keyring with a singleton additionalDecryptionKeyMaterial map.
* This tests the behavior when a single additional key material is provided.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithSingletonAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("aes-singleton-additional-key-material");
final String input = "AES with singleton additional key material";
@@ -265,7 +265,7 @@ public void testAesKeyringWithSingletonAdditionalKeyMaterial() {
* Test AES keyring with multiple entries in the additionalDecryptionKeyMaterial map.
* This tests the behavior when multiple additional key materials are provided.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithMultipleAdditionalKeyMaterials() {
final String objectKey = appendTestSuffix("aes-multiple-additional-key-materials");
final String input = "AES with multiple additional key materials";
@@ -348,7 +348,7 @@ public void testAesKeyringWithMultipleAdditionalKeyMaterials() {
* Test AES keyring with additionalDecryptionKeyMaterial that doesn't match.
* This tests the behavior when no matching key material is found and it should fall back to the default key.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithNonMatchingAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("aes-non-matching-additional-key-material");
final String input = "AES with non-matching additional key material";
@@ -423,7 +423,7 @@ public void testAesKeyringWithNonMatchingAdditionalKeyMaterial() {
* Test AES keyring with additionalDecryptionKeyMaterial that doesn't match and a wrong default key.
* This tests the behavior when no matching key material is found and the default key is also wrong.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithNonMatchingAdditionalKeyMaterialAndWrongDefaultKey() {
final String objectKey = appendTestSuffix("aes-non-matching-additional-key-material-wrong-default");
final String input = "AES with non-matching additional key material and wrong default key";
@@ -494,7 +494,7 @@ public void testAesKeyringWithNonMatchingAdditionalKeyMaterialAndWrongDefaultKey
* Test RSA keyring with null additionalDecryptionKeyMaterial map.
* This tests the default behavior when no additional key material is provided.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringWithNullAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("rsa-null-additional-key-material");
final String input = "RSA with null additional key material";
@@ -564,7 +564,7 @@ public void testRsaKeyringWithNullAdditionalKeyMaterial() {
* Test RSA keyring with empty additionalDecryptionKeyMaterial map.
* This tests the behavior when an empty map is provided.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringWithEmptyAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("rsa-empty-additional-key-material");
final String input = "RSA with empty additional key material";
@@ -635,7 +635,7 @@ public void testRsaKeyringWithEmptyAdditionalKeyMaterial() {
* Test RSA keyring with a singleton additionalDecryptionKeyMaterial map.
* This tests the behavior when a single additional key material is provided.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringWithSingletonAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("rsa-singleton-additional-key-material");
final String input = "RSA with singleton additional key material";
@@ -715,7 +715,7 @@ public void testRsaKeyringWithSingletonAdditionalKeyMaterial() {
* Test RSA keyring with multiple entries in the additionalDecryptionKeyMaterial map.
* This tests the behavior when multiple additional key materials are provided.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringWithMultipleAdditionalKeyMaterials() {
final String objectKey = appendTestSuffix("rsa-multiple-additional-key-materials");
final String input = "RSA with multiple additional key materials";
@@ -810,7 +810,7 @@ public void testRsaKeyringWithMultipleAdditionalKeyMaterials() {
* Test RSA keyring with additionalDecryptionKeyMaterial that doesn't match.
* This tests the behavior when no matching key material is found and it should fall back to the default key.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringWithNonMatchingAdditionalKeyMaterial() {
final String objectKey = appendTestSuffix("rsa-non-matching-additional-key-material");
final String input = "RSA with non-matching additional key material";
@@ -894,7 +894,7 @@ public void testRsaKeyringWithNonMatchingAdditionalKeyMaterial() {
* Test RSA keyring with additionalDecryptionKeyMaterial that doesn't match and a wrong default key.
* This tests the behavior when no matching key material is found and the default key is also wrong.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringWithNonMatchingAdditionalKeyMaterialAndWrongDefaultKey() {
final String objectKey = appendTestSuffix("rsa-non-matching-additional-key-material-wrong-default");
final String input = "RSA with non-matching additional key material and wrong default key";
diff --git a/src/test/java/software/amazon/encryption/s3/ParameterMalleabilityTest.java b/src/test/java/software/amazon/encryption/s3/ParameterMalleabilityTest.java
index 266509022..3e2306484 100644
--- a/src/test/java/software/amazon/encryption/s3/ParameterMalleabilityTest.java
+++ b/src/test/java/software/amazon/encryption/s3/ParameterMalleabilityTest.java
@@ -1,7 +1,7 @@
package software.amazon.encryption.s3;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.services.s3.S3Client;
@@ -30,7 +30,7 @@ public static void setUp() throws NoSuchAlgorithmException {
AES_KEY = keyGen.generateKey();
}
- @Test
+ @RetryingTest(3)
public void contentEncryptionDowngradeAttackFails() {
final String objectKey = appendTestSuffix("content-downgrade-attack-fails");
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -74,7 +74,7 @@ public void contentEncryptionDowngradeAttackFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void keyWrapRemovalAttackFails() {
final String objectKey = appendTestSuffix("keywrap-removal-attack-fails");
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -116,7 +116,7 @@ public void keyWrapRemovalAttackFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void keyWrapDowngradeAesWrapAttackFails() {
final String objectKey = appendTestSuffix("keywrap-downgrade-aeswrap-attack-fails");
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -159,7 +159,7 @@ public void keyWrapDowngradeAesWrapAttackFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void keyWrapDowngradeAesAttackFails() {
final String objectKey = appendTestSuffix("keywrap-downgrade-aes-attack-fails");
S3Client s3Client = S3EncryptionClient.builderV4()
diff --git a/src/test/java/software/amazon/encryption/s3/S3AsyncEncryptionClientTest.java b/src/test/java/software/amazon/encryption/s3/S3AsyncEncryptionClientTest.java
index 122408653..4a9aa9483 100644
--- a/src/test/java/software/amazon/encryption/s3/S3AsyncEncryptionClientTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3AsyncEncryptionClientTest.java
@@ -17,7 +17,7 @@
import org.apache.commons.io.IOUtils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.core.ResponseBytes;
@@ -96,7 +96,7 @@ public static void setUp() throws NoSuchAlgorithmException {
PROVIDER = Security.getProvider("BC");
}
- @Test
+ @RetryingTest(3)
public void asyncCustomConfiguration() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-custom-credentials-async");
@@ -145,7 +145,7 @@ public void asyncCustomConfiguration() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void asyncTopLevelConfigurationAllOptions() {
final String objectKey = appendTestSuffix("async-top-level-all-options");
AwsCredentialsProvider creds = DefaultCredentialsProvider.create();
@@ -192,7 +192,7 @@ public void asyncTopLevelConfigurationAllOptions() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void asyncTopLevelConfiguration() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-top-level-credentials-async");
@@ -225,7 +225,7 @@ public void asyncTopLevelConfiguration() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3AsyncEncryptionClientTopLevelAlternateCredentials() {
final String objectKey = appendTestSuffix("wrapped-s3-async-client-with-top-level-alternate-credentials");
final String input = "S3EncryptionClientTopLevelAlternateCredsTest";
@@ -279,7 +279,7 @@ public void s3AsyncEncryptionClientTopLevelAlternateCredentials() {
s3ClientAltCreds.close();
}
- @Test
+ @RetryingTest(3)
public void s3AsyncEncryptionClientMixedCredentials() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-mixed-credentials");
final String input = "S3EncryptionClientTopLevelAlternateCredsTest";
@@ -321,7 +321,7 @@ public void s3AsyncEncryptionClientMixedCredentials() {
kmsClient.close();
}
- @Test
+ @RetryingTest(3)
public void asyncTopLevelConfigurationWrongRegion() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-wrong-region-credentials-async");
@@ -349,7 +349,7 @@ public void asyncTopLevelConfigurationWrongRegion() {
}
}
- @Test
+ @RetryingTest(3)
public void asyncTopLevelConfigurationNullCreds() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-null-credentials-async");
@@ -377,7 +377,7 @@ public void asyncTopLevelConfigurationNullCreds() {
}
}
- @Test
+ @RetryingTest(3)
public void putAsyncGetDefault() {
final String objectKey = appendTestSuffix("put-async-get-default");
@@ -410,7 +410,7 @@ public void putAsyncGetDefault() {
s3AsyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void putDefaultGetAsync() {
final String objectKey = appendTestSuffix("put-default-get-async");
@@ -443,7 +443,7 @@ public void putDefaultGetAsync() {
s3AsyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void putAsyncGetAsync() {
final String objectKey = appendTestSuffix("put-async-get-async");
@@ -473,7 +473,7 @@ public void putAsyncGetAsync() {
s3AsyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void aesCbcV1toV3Async() {
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-async");
@@ -512,7 +512,7 @@ public void aesCbcV1toV3Async() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void failAesCbcV1toV3AsyncWhenDisabled() {
final String objectKey = appendTestSuffix("fail-aes-cbc-v1-to-v3-async-when-disabled");
@@ -549,7 +549,7 @@ public void failAesCbcV1toV3AsyncWhenDisabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AsyncAesGcmV2toV3WithInstructionFile() {
final String objectKey = appendTestSuffix("async-aes-gcm-v2-to-v3-with-instruction-file");
@@ -588,7 +588,7 @@ public void AsyncAesGcmV2toV3WithInstructionFile() {
s3AsyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectWithInstructionFileSuccessAsync() {
final String objectKey = appendTestSuffix("async-delete-object-with-instruction-file");
@@ -631,7 +631,7 @@ public void deleteObjectWithInstructionFileSuccessAsync() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectsWithInstructionFilesSuccessAsync() {
final String[] objectKeys = {appendTestSuffix("async-delete-object-with-instruction-file-1"),
appendTestSuffix("async-delete-object-with-instruction-file-2"),
@@ -680,7 +680,7 @@ public void deleteObjectsWithInstructionFilesSuccessAsync() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectWithWrongObjectKeySuccessAsync() {
// V3 Client
S3AsyncClient s3Client = S3AsyncEncryptionClient.builderV4()
@@ -692,7 +692,7 @@ public void deleteObjectWithWrongObjectKeySuccessAsync() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void copyObjectTransparentlyAsync() {
final String objectKey = appendTestSuffix("copy-object-from-here-async");
final String newObjectKey = appendTestSuffix("copy-object-to-here-async");
@@ -741,7 +741,7 @@ public void copyObjectTransparentlyAsync() {
* to be logged when debug logging is enabled.
* @throws IOException
*/
- @Test
+ @RetryingTest(3)
public void tinyBufferTest() throws IOException {
// BouncyCastle actually returns null buffers, unlike ACCP and SunJCE, which return empty buffers
Security.addProvider(new BouncyCastleProvider());
@@ -781,7 +781,7 @@ public void tinyBufferTest() throws IOException {
exec.shutdown();
}
- @Test
+ @RetryingTest(3)
public void testAsyncInstructionFileConfig() {
final String objectKey = appendTestSuffix("async-instruction-file-config");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -841,7 +841,7 @@ public void testAsyncInstructionFileConfig() {
s3ClientDisabledInstructionFile.close();
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testAsyncInstructionFileConfigMultipart() {
final String objectKey = appendTestSuffix("test-multipart-async-instruction-file-config");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -885,7 +885,7 @@ public void testAsyncInstructionFileConfigMultipart() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testAsyncInstructionFileConfigMultipartWithOptions() {
final String objectKey = appendTestSuffix("test-multipart-async-instruction-file-config-options");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -934,7 +934,7 @@ public void testAsyncInstructionFileConfigMultipartWithOptions() {
}
- @Test
+ @RetryingTest(3)
public void wrappedClientMultipartUploadThrowsException() throws IOException {
final String objectKey = appendTestSuffix("multipart-put-object-async-wrapped-client");
@@ -1013,21 +1013,21 @@ public void wrappedClientMultipartUploadThrowsException() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3AsyncClientBuilderForbidsMultipartEnabled() {
assertThrows(
UnsupportedOperationException.class,
() -> S3AsyncEncryptionClient.builderV4().multipartEnabled(Boolean.TRUE));
}
- @Test
+ @RetryingTest(3)
public void s3AsyncClientBuilderForbidsMultipartConfiguration() {
assertThrows(
UnsupportedOperationException.class,
() -> S3AsyncEncryptionClient.builderV4().multipartConfiguration(MultipartConfiguration.builder().build()));
}
- @Test
+ @RetryingTest(3)
public void s3AsyncClientForbidsCreateMultipartUpload() {
S3AsyncClient s3AsyncClient = S3AsyncEncryptionClient.builderV4()
.kmsKeyId("fails")
@@ -1037,7 +1037,7 @@ public void s3AsyncClientForbidsCreateMultipartUpload() {
s3AsyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void s3AsyncClientForbidsUploadPart() {
S3AsyncClient s3AsyncClient = S3AsyncEncryptionClient.builderV4()
.kmsKeyId("fails")
@@ -1047,7 +1047,7 @@ public void s3AsyncClientForbidsUploadPart() {
s3AsyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void s3AsyncClientForbidsCompleteMultipartUpload() {
S3AsyncClient s3AsyncClient = S3AsyncEncryptionClient.builderV4()
.kmsKeyId("fails")
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientBuilderValidationTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientBuilderValidationTest.java
index 9d39c4ebf..117ad826c 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientBuilderValidationTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientBuilderValidationTest.java
@@ -12,7 +12,7 @@
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.algorithms.AlgorithmSuite;
import software.amazon.encryption.s3.materials.AesKeyring;
@@ -20,7 +20,7 @@
public class S3EncryptionClientBuilderValidationTest {
- @Test
+ @RetryingTest(3)
public void testBuilderWithMultipleKeyringTypesFails() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -58,7 +58,7 @@ public void testBuilderWithMultipleKeyringTypesFails() throws NoSuchAlgorithmExc
assertTrue(exception3.getMessage().contains("Only one may be set of"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithNoKeyringFails() {
S3EncryptionClientException exception = assertThrows(S3EncryptionClientException.class, () ->
S3EncryptionClient.builderV4().build()
@@ -66,7 +66,7 @@ public void testBuilderWithNoKeyringFails() {
assertTrue(exception.getMessage().contains("Exactly one must be set of"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithCMMAndKeyringFails() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -86,7 +86,7 @@ public void testBuilderWithCMMAndKeyringFails() throws NoSuchAlgorithmException
assertTrue(exception.getMessage().contains("Only one may be set of"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithInvalidBufferSizes() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -111,7 +111,7 @@ public void testBuilderWithInvalidBufferSizes() throws NoSuchAlgorithmException
assertTrue(exception2.getMessage().contains("Invalid buffer size"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithBufferSizeAndDelayedAuthFails() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -130,7 +130,7 @@ public void testBuilderWithBufferSizeAndDelayedAuthFails() throws NoSuchAlgorith
assertTrue(exception.getMessage().contains("Buffer size cannot be set when delayed authentication mode is enabled"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithNullSecureRandomFails() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -145,7 +145,7 @@ public void testBuilderWithNullSecureRandomFails() throws NoSuchAlgorithmExcepti
assertTrue(exception.getMessage().contains("SecureRandom provided to S3EncryptionClient cannot be null"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithInvalidCommitmentPolicyAlgorithmCombination() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -172,7 +172,7 @@ public void testBuilderWithInvalidCommitmentPolicyAlgorithmCombination() throws
assertTrue(exception2.getMessage().contains("commitment policy forbids encryption with committing algorithm"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithLegacyAlgorithmFails() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -187,7 +187,7 @@ public void testBuilderWithLegacyAlgorithmFails() throws NoSuchAlgorithmExceptio
assertTrue(exception.getMessage().contains("Encryption algorithm provided is LEGACY"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithWrappedS3EncryptionClientFails() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -209,7 +209,7 @@ public void testBuilderWithWrappedS3EncryptionClientFails() throws NoSuchAlgorit
wrappedEncryptionClient.close();
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithWrappedS3AsyncEncryptionClientFails() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -231,7 +231,7 @@ public void testBuilderWithWrappedS3AsyncEncryptionClientFails() throws NoSuchAl
wrappedAsyncEncryptionClient.close();
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithInvalidAesKey() throws NoSuchAlgorithmException {
// Test with DES key instead of AES
KeyGenerator desKeyGen = KeyGenerator.getInstance("DES");
@@ -247,7 +247,7 @@ public void testBuilderWithInvalidAesKey() throws NoSuchAlgorithmException {
assertTrue(exception.getMessage().contains("expecting AES"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithInvalidRsaKey() throws NoSuchAlgorithmException {
// Test with EC key instead of RSA
KeyPairGenerator ecKeyGen = KeyPairGenerator.getInstance("EC");
@@ -263,7 +263,7 @@ public void testBuilderWithInvalidRsaKey() throws NoSuchAlgorithmException {
assertTrue(exception.getMessage().contains("Only RSA keys are supported"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithEmptyKmsKeyId() {
S3EncryptionClientException exception = assertThrows(S3EncryptionClientException.class, () ->
S3EncryptionClient.builderV4()
@@ -273,7 +273,7 @@ public void testBuilderWithEmptyKmsKeyId() {
assertTrue(exception.getMessage().contains("Kms Key ID cannot be empty or null"));
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithNullKmsKeyId() {
S3EncryptionClientException exception = assertThrows(S3EncryptionClientException.class, () ->
S3EncryptionClient.builderV4()
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCRTTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCRTTest.java
index d77de3675..e3396a9fe 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCRTTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCRTTest.java
@@ -11,7 +11,7 @@
import org.apache.commons.io.IOUtils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.async.AsyncRequestBody;
@@ -62,7 +62,7 @@ public static void setUp() throws NoSuchAlgorithmException {
PROVIDER = Security.getProvider("BC");
}
- @Test
+ @RetryingTest(3)
public void AsyncAesGcmV3toV3RangedGet() {
final String objectKey = appendTestSuffix("async-aes-gcm-v3-to-v3-ranged-get");
@@ -130,7 +130,7 @@ public void AsyncAesGcmV3toV3RangedGet() {
asyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void AsyncFailsOnRangeWhenLegacyModeDisabled() {
final String objectKey = appendTestSuffix("fails-when-on-range-when-legacy-disabled");
final String input = "0bcdefghijklmnopqrst0BCDEFGHIJKLMNOPQRST" +
@@ -162,7 +162,7 @@ public void AsyncFailsOnRangeWhenLegacyModeDisabled() {
asyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void AsyncAesCbcV1toV3RangedGet() {
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-ranged-get-async");
@@ -243,7 +243,7 @@ public void AsyncAesCbcV1toV3RangedGet() {
}
- @Test
+ @RetryingTest(3)
public void failsOnRangeWhenLegacyModeDisabled() {
final String objectKey = appendTestSuffix("fails-when-on-range-when-legacy-disabled");
final String input = "0bcdefghijklmnopqrst0BCDEFGHIJKLMNOPQRST" +
@@ -276,7 +276,7 @@ public void failsOnRangeWhenLegacyModeDisabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV3toV3RangedGet() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3-ranged-get");
@@ -344,7 +344,7 @@ public void AesGcmV3toV3RangedGet() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV3toV3FailsRangeExceededObjectLength() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3-ranged-get-out-of-range");
@@ -379,7 +379,7 @@ public void AesGcmV3toV3FailsRangeExceededObjectLength() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AsyncAesGcmV3toV3FailsRangeExceededObjectLength() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3-ranged-get-out-of-range");
@@ -415,7 +415,7 @@ public void AsyncAesGcmV3toV3FailsRangeExceededObjectLength() {
asyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void AesCbcV1toV3RangedGet() {
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-ranged-get");
@@ -505,7 +505,7 @@ public void AesCbcV1toV3RangedGet() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesCbcV1toV3FailsRangeExceededObjectLength() {
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3-ranged-get-out-of-range");
@@ -548,7 +548,7 @@ public void AesCbcV1toV3FailsRangeExceededObjectLength() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AsyncAesGcmV3toV3LargeObjectCRT() throws IOException {
final String objectKey = appendTestSuffix("async-aes-gcm-v3-to-v3-large-object-crt");
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCommitmentPolicyTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCommitmentPolicyTest.java
index cfcaf452c..e01ac841f 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCommitmentPolicyTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCommitmentPolicyTest.java
@@ -12,7 +12,7 @@
import static software.amazon.encryption.s3.utils.S3EncryptionClientTestResources.deleteObject;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
@@ -40,7 +40,7 @@ public static void setUp() throws NoSuchAlgorithmException {
AES_KEY = keyGen.generateKey();
}
- @Test
+ @RetryingTest(3)
public void testCommitmentPolicyAndEncryptionAlgorithm() {
//= specification/s3-encryption/client.md#encryption-algorithm
//= type=test
@@ -143,7 +143,7 @@ public void testCommitmentPolicyAndEncryptionAlgorithm() {
}
- @Test
+ @RetryingTest(3)
public void testCommitmentPolicyForbidEncryptAllowDecrypt() {
final String objectKey = appendTestSuffix("commitment-policy-forbid-encrypt-allow-decrypt");
@@ -216,7 +216,7 @@ public void testCommitmentPolicyForbidEncryptAllowDecrypt() {
requireRequireClient.close();
}
- @Test
+ @RetryingTest(3)
public void testCommitmentPolicyRequireEncryptAllowDecrypt() {
final String objectKey = appendTestSuffix("commitment-policy-require-encrypt-allow-decrypt");
@@ -288,7 +288,7 @@ public void testCommitmentPolicyRequireEncryptAllowDecrypt() {
requireRequireClient.close();
}
- @Test
+ @RetryingTest(3)
public void testCommitmentPolicyRequireEncryptRequireDecrypt() {
final String objectKey = appendTestSuffix("commitment-policy-require-encrypt-require-decrypt");
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCompatibilityTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCompatibilityTest.java
index 39720d998..d1c75b3fc 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCompatibilityTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientCompatibilityTest.java
@@ -26,7 +26,7 @@
import javax.crypto.SecretKey;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import com.amazonaws.services.kms.AWSKMS;
import com.amazonaws.services.kms.AWSKMSClientBuilder;
@@ -78,7 +78,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void AesCbcV1toV3() {
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3");
@@ -128,7 +128,7 @@ public void AesCbcV1toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesCbcV1toV4() {
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v4");
@@ -165,7 +165,7 @@ public void AesCbcV1toV4() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesWrapV1toV3() {
final String objectKey = appendTestSuffix("aes-wrap-v1-to-v3");
@@ -202,7 +202,7 @@ public void AesWrapV1toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesWrapV1toV4() {
final String objectKey = appendTestSuffix("aes-wrap-v1-to-v4");
@@ -236,7 +236,7 @@ public void AesWrapV1toV4() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV2toV3() {
final String objectKey = appendTestSuffix("aes-gcm-v2-to-v3");
@@ -270,7 +270,7 @@ public void AesGcmV2toV3() {
}
- @Test
+ @RetryingTest(3)
public void AesGcmV2toV4() {
final String objectKey = appendTestSuffix("aes-gcm-v2-to-v4");
@@ -301,7 +301,7 @@ public void AesGcmV2toV4() {
}
- @Test
+ @RetryingTest(3)
public void AesGcmV2toV3WithInstructionFile() {
final String objectKey = appendTestSuffix("aes-gcm-v2-to-v3-with-instruction-file");
@@ -342,7 +342,7 @@ public void AesGcmV2toV3WithInstructionFile() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV2toV4WithInstructionFile() {
final String objectKey = appendTestSuffix("aes-gcm-v2-to-v4-with-instruction-file");
@@ -379,7 +379,7 @@ public void AesGcmV2toV4WithInstructionFile() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV3toV1() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v1");
@@ -414,7 +414,7 @@ public void AesGcmV3toV1() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV4toV1Fails() {
final String objectKey = appendTestSuffix("aes-gcm-v4-to-v1");
@@ -460,7 +460,7 @@ public void AesGcmV4toV1Fails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV3toV2() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v2");
@@ -492,7 +492,7 @@ public void AesGcmV3toV2() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV4toV2Fails() {
final String objectKey = appendTestSuffix("aes-gcm-v4-to-v2");
@@ -521,7 +521,7 @@ public void AesGcmV4toV2Fails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV3toV3() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3");
@@ -550,7 +550,7 @@ public void AesGcmV3toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV3toV4FailsWithRequireDecrypt() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v4");
@@ -584,7 +584,7 @@ public void AesGcmV3toV4FailsWithRequireDecrypt() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV4toV4() {
final String objectKey = appendTestSuffix("aes-gcm-v4-to-v4");
@@ -614,7 +614,7 @@ public void AesGcmV4toV4() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV4toV3() {
final String objectKey = appendTestSuffix("aes-gcm-v4-to-v3");
@@ -649,7 +649,7 @@ public void AesGcmV4toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaV1toV3() {
final String objectKey = appendTestSuffix("v1-rsa-to-v3");
@@ -682,7 +682,7 @@ public void RsaV1toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaV1toV4Fails() {
final String objectKey = appendTestSuffix("v1-rsa-to-v4");
@@ -711,7 +711,7 @@ public void RsaV1toV4Fails() {
}
- @Test
+ @RetryingTest(3)
public void RsaV1toV3AesFails() {
final String objectKey = appendTestSuffix("v1-rsa-to-v3-aes-fails");
@@ -738,7 +738,7 @@ public void RsaV1toV3AesFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaEcbV1toV3() {
final String objectKey = appendTestSuffix("rsa-ecb-v1-to-v3");
@@ -775,7 +775,7 @@ public void RsaEcbV1toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaEcbV1toV4Fails() {
final String objectKey = appendTestSuffix("rsa-ecb-v1-to-v4");
@@ -809,7 +809,7 @@ public void RsaEcbV1toV4Fails() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaOaepV2toV3() {
final String objectKey = appendTestSuffix("rsa-oaep-v2-to-v3");
@@ -845,7 +845,7 @@ public void RsaOaepV2toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaOaepV2toV4Fails() {
final String objectKey = appendTestSuffix("rsa-oaep-v2-to-v4");
@@ -878,7 +878,7 @@ public void RsaOaepV2toV4Fails() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaOaepV3toV1() {
final String objectKey = appendTestSuffix("rsa-oaep-v3-to-v1");
@@ -913,7 +913,7 @@ public void RsaOaepV3toV1() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaOaepV3toV2() {
final String objectKey = appendTestSuffix("rsa-oaep-v3-to-v2");
@@ -945,7 +945,7 @@ public void RsaOaepV3toV2() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaOaepV4toV2Fails() {
final String objectKey = appendTestSuffix("rsa-oaep-v4-to-v2");
@@ -974,7 +974,7 @@ public void RsaOaepV4toV2Fails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaOaepV3toV3() {
final String objectKey = appendTestSuffix("rsa-oaep-v3-to-v3");
@@ -1003,7 +1003,7 @@ public void RsaOaepV3toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaOaepV4toV4() {
final String objectKey = appendTestSuffix("rsa-oaep-v4-to-v3");
@@ -1033,7 +1033,7 @@ public void RsaOaepV4toV4() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsCBCV1ToV3() {
String objectKey = appendTestSuffix("v1-kms-cbc-to-v3");
@@ -1072,7 +1072,7 @@ public void KmsCBCV1ToV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsCBCV1ToV4Fails() {
String objectKey = appendTestSuffix("v1-kms-cbc-to-v4");
@@ -1106,7 +1106,7 @@ public void KmsCBCV1ToV4Fails() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsV1toV3() {
final String objectKey = appendTestSuffix("kms-v1-to-v3");
@@ -1146,7 +1146,7 @@ public void KmsV1toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsV1toV4() {
final String objectKey = appendTestSuffix("kms-v1-to-v4");
@@ -1182,7 +1182,7 @@ public void KmsV1toV4() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsContextV2toV3() {
final String objectKey = appendTestSuffix("kms-context-v2-to-v3");
@@ -1226,7 +1226,7 @@ public void KmsContextV2toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsContextV2toV4Fails() {
final String objectKey = appendTestSuffix("kms-context-v2-to-v4");
@@ -1267,7 +1267,7 @@ public void KmsContextV2toV4Fails() {
}
// All Below cases should expect failure, since we're writing with V3 Message Format
- @Test
+ @RetryingTest(3)
public void KmsContextV3toV1() {
final String objectKey = appendTestSuffix("kms-context-v3-to-v1");
@@ -1312,7 +1312,7 @@ public void KmsContextV3toV1() {
}
- @Test
+ @RetryingTest(3)
public void KmsContextV4toV1Fails() {
final String objectKey = appendTestSuffix("kms-context-v4-to-v1");
@@ -1370,7 +1370,7 @@ public void KmsContextV4toV1Fails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsContextV3toV2() throws IOException {
final String objectKey = appendTestSuffix("kms-context-v3-to-v2");
@@ -1408,7 +1408,7 @@ public void KmsContextV3toV2() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsContextV4toV2Fails() throws IOException {
final String objectKey = appendTestSuffix("kms-context-v4-to-v2");
@@ -1444,7 +1444,7 @@ public void KmsContextV4toV2Fails() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsContextV3toV3() {
final String objectKey = appendTestSuffix("kms-context-v3-to-v3");
@@ -1478,7 +1478,7 @@ public void KmsContextV3toV3() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsContextV4toV4() {
final String objectKey = appendTestSuffix("kms-context-v4-to-v3");
@@ -1513,7 +1513,7 @@ public void KmsContextV4toV4() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsContextV3toV3MismatchFails() {
final String objectKey = appendTestSuffix("kms-context-v3-to-v3");
@@ -1548,7 +1548,7 @@ public void KmsContextV3toV3MismatchFails() {
}
- @Test
+ @RetryingTest(3)
public void AesCbcV1toV3FailsWhenLegacyModeDisabled() {
final String objectKey = appendTestSuffix("aes-cbc-v1-to-v3");
@@ -1588,7 +1588,7 @@ public void AesCbcV1toV3FailsWhenLegacyModeDisabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesCbcV1toV3FailsWhenUnauthencticateModeDisabled() {
final String objectKey = appendTestSuffix("fails-aes-cbc-v1-to-v3-when-unauthencticate-mode-disabled");
@@ -1628,7 +1628,7 @@ public void AesCbcV1toV3FailsWhenUnauthencticateModeDisabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesCbcV1toV3FailsWhenLegacyKeyringDisabled() {
final String objectKey = appendTestSuffix("fails-aes-cbc-v1-to-v3-when-legacy-keyring-disabled");
@@ -1668,7 +1668,7 @@ public void AesCbcV1toV3FailsWhenLegacyKeyringDisabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesWrapV1toV3FailsWhenLegacyModeDisabled() {
final String objectKey = appendTestSuffix("aes-wrap-v1-to-v3");
@@ -1698,7 +1698,7 @@ public void AesWrapV1toV3FailsWhenLegacyModeDisabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void nullMaterialDescriptionV3() {
final String objectKey = appendTestSuffix("null-matdesc-v3");
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientInstructionFileTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientInstructionFileTest.java
index ea30865bc..a3039e9c6 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientInstructionFileTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientInstructionFileTest.java
@@ -10,7 +10,7 @@
import com.amazonaws.services.s3.model.KMSEncryptionMaterials;
import com.amazonaws.services.s3.model.StaticEncryptionMaterialsProvider;
import org.apache.commons.io.IOUtils;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.sync.RequestBody;
@@ -57,7 +57,7 @@
public class S3EncryptionClientInstructionFileTest {
- @Test
+ @RetryingTest(3)
public void testS3EncryptionClientInstructionFileV1V2Format() {
final String objectKey = appendTestSuffix("simple-instruction-file-v1-v2-test");
final String input = "testS3EncryptionClientInstructionFile";
@@ -144,7 +144,7 @@ public void testS3EncryptionClientInstructionFileV1V2Format() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void testS3EncryptionClientInstructionFileV3Format() {
final String objectKey = appendTestSuffix("simple-instruction-file-v3-test");
final String input = "testS3EncryptionClientInstructionFile";
@@ -257,7 +257,7 @@ public void testS3EncryptionClientInstructionFileV3Format() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void testV4TransitionInstructionFileExists() {
final String objectKey = appendTestSuffix("instruction-file-put-object");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -299,7 +299,7 @@ public void testV4TransitionInstructionFileExists() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void testV4InstructionFileExists() {
final String objectKey = appendTestSuffix("instruction-file-put-object");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -339,7 +339,7 @@ public void testV4InstructionFileExists() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void testV4TransitionDisabledClientFails() {
final String objectKey = appendTestSuffix("instruction-file-put-object-disabled-fails");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -384,7 +384,7 @@ public void testV4TransitionDisabledClientFails() {
s3ClientDisabledInstructionFile.close();
}
- @Test
+ @RetryingTest(3)
public void testV4DisabledClientFails() {
final String objectKey = appendTestSuffix("instruction-file-put-object-disabled-fails");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -432,7 +432,7 @@ public void testV4DisabledClientFails() {
* This test is somewhat redundant given deletion itself is tested in
* e.g. deleteObjectWithInstructionFileSuccess, but is included anyway to be thorough
*/
- @Test
+ @RetryingTest(3)
public void testV4TransitionInstructionFileDelete() {
final String objectKey = appendTestSuffix("instruction-file-put-object-delete");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -485,7 +485,7 @@ public void testV4TransitionInstructionFileDelete() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void testV4InstructionFileDelete() {
final String objectKey = appendTestSuffix("instruction-file-put-object-delete");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -536,7 +536,7 @@ public void testV4InstructionFileDelete() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void testPutWithInstructionFileV4TransitionToV2Kms() {
final String objectKey = appendTestSuffix("instruction-file-put-object-v3-to-v2-kms");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -575,7 +575,7 @@ public void testPutWithInstructionFileV4TransitionToV2Kms() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testPutWithInstructionFileV4TransitionToV2Aes() throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
@@ -617,7 +617,7 @@ public void testPutWithInstructionFileV4TransitionToV2Aes() throws NoSuchAlgorit
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testPutWithInstructionFileV4TransitionToV2Rsa() throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
keyPairGen.initialize(2048);
@@ -660,7 +660,7 @@ public void testPutWithInstructionFileV4TransitionToV2Rsa() throws NoSuchAlgorit
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testV4TransitionMultipartPutWithInstructionFile() throws IOException {
final String object_key = appendTestSuffix("test-multipart-put-instruction-file");
@@ -711,7 +711,7 @@ public void testV4TransitionMultipartPutWithInstructionFile() throws IOException
}
- @Test
+ @RetryingTest(3)
public void testV4MultipartPutWithInstructionFile() throws IOException {
final String object_key = appendTestSuffix("test-multipart-put-instruction-file");
@@ -760,7 +760,7 @@ public void testV4MultipartPutWithInstructionFile() throws IOException {
}
- @Test
+ @RetryingTest(3)
public void testV4TransitionLowLevelMultipartPutWithInstructionFile() throws NoSuchAlgorithmException, IOException {
final String object_key = appendTestSuffix("test-low-level-multipart-put-instruction-file");
@@ -862,7 +862,7 @@ public void testV4TransitionLowLevelMultipartPutWithInstructionFile() throws NoS
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testV4LowLevelMultipartPutWithInstructionFile() throws NoSuchAlgorithmException, IOException {
final String object_key = appendTestSuffix("test-low-level-multipart-put-instruction-file");
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescAndEncContextV3FormatTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescAndEncContextV3FormatTest.java
index b3ddffc9e..7edd55e9a 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescAndEncContextV3FormatTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescAndEncContextV3FormatTest.java
@@ -1,7 +1,7 @@
package software.amazon.encryption.s3;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.protocols.jsoncore.JsonNode;
@@ -46,7 +46,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void testKmsEncryptionContextInObjectMetadata() {
S3EncryptionClient client = S3EncryptionClient
.builderV4()
@@ -80,7 +80,7 @@ public void testKmsEncryptionContextInObjectMetadata() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesMaterialsDescriptionInObjectMetadata() {
AesKeyring aesKeyring = AesKeyring
.builder()
@@ -118,7 +118,7 @@ public void testAesMaterialsDescriptionInObjectMetadata() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaMaterialsDescriptionInObjectMetadata() {
PartialRsaKeyPair keyPair = new PartialRsaKeyPair(
RSA_KEY_PAIR.getPrivate(),
@@ -165,7 +165,7 @@ public void testRsaMaterialsDescriptionInObjectMetadata() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testKmsEncryptionContextInInstructionFile() {
S3Client wrappedClient = S3Client.create();
@@ -222,7 +222,7 @@ public void testKmsEncryptionContextInInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesMaterialsDescriptionInInstructionFile() {
AesKeyring aesKeyring = AesKeyring
.builder()
@@ -282,7 +282,7 @@ public void testAesMaterialsDescriptionInInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaMaterialsDescriptionInInstructionFile() {
PartialRsaKeyPair keyPair = new PartialRsaKeyPair(
RSA_KEY_PAIR.getPrivate(),
@@ -351,7 +351,7 @@ public void testRsaMaterialsDescriptionInInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringMatDescOverridesPutObjectEncryptionContext() {
AesKeyring aesKeyring = AesKeyring
.builder()
@@ -415,7 +415,7 @@ public void testAesKeyringMatDescOverridesPutObjectEncryptionContext() {
assertNull(matDescNode.asObject().get("admin"));
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringMatDescOverridesPutObjectEncryptionContext() {
PartialRsaKeyPair keyPair = new PartialRsaKeyPair(
RSA_KEY_PAIR.getPrivate(),
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescTest.java
index 4b678008a..20f89a971 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMatDescTest.java
@@ -1,7 +1,7 @@
package software.amazon.encryption.s3;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.protocols.jsoncore.JsonNode;
@@ -46,7 +46,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void testAesMaterialsDescriptionInObjectMetadata() {
AesKeyring aesKeyring = AesKeyring
.builder()
@@ -85,7 +85,7 @@ public void testAesMaterialsDescriptionInObjectMetadata() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaMaterialsDescriptionInObjectMetadata() {
PartialRsaKeyPair keyPair = new PartialRsaKeyPair(
RSA_KEY_PAIR.getPrivate(),
@@ -133,7 +133,7 @@ public void testRsaMaterialsDescriptionInObjectMetadata() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesMaterialsDescriptionInInstructionFile() {
AesKeyring aesKeyring = AesKeyring
.builder()
@@ -192,7 +192,7 @@ public void testAesMaterialsDescriptionInInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaMaterialsDescriptionInInstructionFile() {
PartialRsaKeyPair keyPair = new PartialRsaKeyPair(
RSA_KEY_PAIR.getPrivate(),
@@ -261,7 +261,7 @@ public void testRsaMaterialsDescriptionInInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringMatDescOverridesPutObjectEncryptionContext() {
AesKeyring aesKeyring = AesKeyring
.builder()
@@ -327,7 +327,7 @@ public void testAesKeyringMatDescOverridesPutObjectEncryptionContext() {
assertNull(matDescNode.asObject().get("admin"));
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringMatDescOverridesPutObjectEncryptionContext() {
PartialRsaKeyPair keyPair = new PartialRsaKeyPair(
RSA_KEY_PAIR.getPrivate(),
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMultipartUploadTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMultipartUploadTest.java
index 230632942..43e16bd86 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMultipartUploadTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientMultipartUploadTest.java
@@ -5,7 +5,7 @@
import org.apache.commons.io.IOUtils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.async.AsyncRequestBody;
@@ -60,7 +60,7 @@ public static void setUp() throws NoSuchAlgorithmException {
PROVIDER = Security.getProvider("BC");
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectAsync() throws IOException {
final String objectKey = appendTestSuffix("multipart-put-object-async");
@@ -101,7 +101,7 @@ public void multipartPutObjectAsync() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectAsyncV4Transition() throws IOException {
final String objectKey = appendTestSuffix("multipart-put-object-async");
@@ -144,7 +144,7 @@ public void multipartPutObjectAsyncV4Transition() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectAsyncLargeObjectFails() {
final String objectKey = appendTestSuffix("multipart-put-object-async-large-object-fails");
@@ -173,7 +173,7 @@ public void multipartPutObjectAsyncLargeObjectFails() {
singleThreadExecutor.shutdown();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectAsyncV4TransitionLargeObjectFails() {
final String objectKey = appendTestSuffix("multipart-put-object-async-large-object-fails");
@@ -204,7 +204,7 @@ public void multipartPutObjectAsyncV4TransitionLargeObjectFails() {
singleThreadExecutor.shutdown();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObject() throws IOException {
final String objectKey = appendTestSuffix("multipart-put-object");
@@ -239,7 +239,7 @@ public void multipartPutObject() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectV4Transition() throws IOException {
final String objectKey = appendTestSuffix("multipart-put-object");
@@ -284,7 +284,7 @@ public void multipartPutObjectV4Transition() throws IOException {
have a "long" test suite containing this test and any other tests
which take more than 5-10 minutes to complete.
*/
-// @Test
+// @RetryingTest(3)
// public void multipartUploadV3OutputStreamLargeObjectFails() throws IOException {
// final String objectKey = appendTestSuffix("multipart-upload-v3-output-stream-fails");
//
@@ -376,7 +376,7 @@ public void multipartPutObjectV4Transition() throws IOException {
// s3Client.close();
// }
- @Test
+ @RetryingTest(3)
public void multipartPutObjectLargeObjectFails() {
final String objectKey = appendTestSuffix("multipart-put-object-large-fails");
@@ -402,7 +402,7 @@ public void multipartPutObjectLargeObjectFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectLargeObjectFailsV4Transition() {
final String objectKey = appendTestSuffix("multipart-put-object-large-fails");
@@ -430,7 +430,7 @@ public void multipartPutObjectLargeObjectFailsV4Transition() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartUploadV3OutputStream() throws IOException {
final String objectKey = appendTestSuffix("multipart-upload-v3-output-stream");
// Overall "file" is 100MB, split into 10MB parts
@@ -544,7 +544,7 @@ public void multipartUploadV3OutputStream() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartUploadV3OutputStreamV4Transition() throws IOException {
final String objectKey = appendTestSuffix("multipart-upload-v3-output-stream");
@@ -661,7 +661,7 @@ public void multipartUploadV3OutputStreamV4Transition() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartUploadV3OutputStreamPartSize() throws IOException {
final String objectKey = appendTestSuffix("multipart-upload-v3-output-stream-part-size");
@@ -755,7 +755,7 @@ public void multipartUploadV3OutputStreamPartSize() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartUploadV3OutputStreamPartSizeV4Transition() throws IOException {
final String objectKey = appendTestSuffix("multipart-upload-v3-output-stream-part-size");
@@ -851,7 +851,7 @@ public void multipartUploadV3OutputStreamPartSizeV4Transition() throws IOExcepti
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartUploadV3OutputStreamPartSizeMismatch() throws IOException {
final String objectKey = appendTestSuffix("multipart-upload-v3-output-stream-part-size-mismatch");
@@ -901,7 +901,7 @@ public void multipartUploadV3OutputStreamPartSizeMismatch() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartUploadV3OutputStreamPartSizeMismatchV4Transition() throws IOException {
final String objectKey = appendTestSuffix("multipart-upload-v3-output-stream-part-size-mismatch");
@@ -953,7 +953,7 @@ public void multipartUploadV3OutputStreamPartSizeMismatchV4Transition() throws I
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectWithOptions() throws IOException {
final String objectKey = appendTestSuffix("multipart-put-object-with-options");
@@ -997,7 +997,7 @@ public void multipartPutObjectWithOptions() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void multipartPutObjectWithOptionsV4Transition() throws IOException {
final String objectKey = appendTestSuffix("multipart-put-object-with-options");
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRangedGetCompatibilityTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRangedGetCompatibilityTest.java
index 692de839e..03fb6b0a9 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRangedGetCompatibilityTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRangedGetCompatibilityTest.java
@@ -13,7 +13,6 @@
import com.amazonaws.services.s3.model.KMSEncryptionMaterialsProvider;
import com.amazonaws.services.s3.model.StaticEncryptionMaterialsProvider;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import software.amazon.awssdk.core.ResponseBytes;
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileTest.java
index 5548fafcd..4da62984f 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileTest.java
@@ -17,7 +17,7 @@
import com.amazonaws.services.s3.model.StaticEncryptionMaterialsProvider;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.protocols.jsoncore.JsonNode;
@@ -74,7 +74,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR_TWO = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void testAesReEncryptInstructionFileFailsWithV2NonCommittingAlgorithmMismatch() {
final String objectKey = appendTestSuffix(
"v2-algorithm-mismatch-test"
@@ -153,7 +153,7 @@ public void testAesReEncryptInstructionFileFailsWithV2NonCommittingAlgorithmMism
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileFailsWithV3CommittingAlgorithmMismatch() {
final String objectKey = appendTestSuffix(
"v3-algorithm-mismatch-test"
@@ -231,7 +231,7 @@ public void testReEncryptInstructionFileFailsWithV3CommittingAlgorithmMismatch()
deleteObject(BUCKET, objectKey, v3Client);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileFailsWithLegacyAlgorithm() {
final String objectKey = appendTestSuffix(
"legacy-algorithm-mismatch-test"
@@ -308,7 +308,7 @@ public void testReEncryptInstructionFileFailsWithLegacyAlgorithm() {
deleteObject(BUCKET, objectKey, v3Client);
}
- @Test
+ @RetryingTest(3)
public void testAesReEncryptInstructionFileFailsWithSameMaterialsDescription() {
AesKeyring oldKeyring = AesKeyring
.builder()
@@ -374,7 +374,7 @@ public void testAesReEncryptInstructionFileFailsWithSameMaterialsDescription() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaReEncryptInstructionFileWithCustomSuffixFailsWithSameMaterialsDescription() {
PublicKey clientPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey clientPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -467,7 +467,7 @@ public void testRsaReEncryptInstructionFileWithCustomSuffixFailsWithSameMaterial
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesReEncryptInstructionFileRejectsCustomInstructionFileSuffix() {
AesKeyring oldKeyring = AesKeyring
.builder()
@@ -525,7 +525,7 @@ public void testAesReEncryptInstructionFileRejectsCustomInstructionFileSuffix()
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileFailsWhenInstructionFilePutNotEnabled() {
PublicKey originalPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey originalPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -601,7 +601,7 @@ public void testReEncryptInstructionFileFailsWhenInstructionFilePutNotEnabled()
}
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFile() {
AesKeyring oldKeyring = AesKeyring
.builder()
@@ -763,7 +763,7 @@ public void testAesKeyringReEncryptInstructionFile() {
deleteObject(BUCKET, objectKey, s3Client);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFile() {
PublicKey originalPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey originalPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -929,7 +929,7 @@ public void testRsaKeyringReEncryptInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testV4TransitionAesKeyringReEncryptInstructionFile() {
AesKeyring oldKeyring = AesKeyring
.builder()
@@ -1090,7 +1090,7 @@ public void testV4TransitionAesKeyringReEncryptInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testV4TransitionRsaKeyringReEncryptInstructionFile() {
PublicKey originalPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey originalPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -1269,7 +1269,7 @@ public void testV4TransitionRsaKeyringReEncryptInstructionFile() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffix() {
PublicKey clientPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey clientPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -1482,7 +1482,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffix() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testV4TransitionRsaKeyringReEncryptInstructionFileWithCustomSuffix() {
PublicKey clientPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey clientPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -1698,7 +1698,7 @@ public void testV4TransitionRsaKeyringReEncryptInstructionFileWithCustomSuffix()
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileV2AesToV3() {
final String input =
"Testing re-encryption of instruction file with AES keyrings from V2 to V3";
@@ -1814,7 +1814,7 @@ public void testReEncryptInstructionFileV2AesToV3() {
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileWithCustomSuffixV2RsaToV3()
throws IOException {
final String input =
@@ -1988,7 +1988,7 @@ public void testReEncryptInstructionFileWithCustomSuffixV2RsaToV3()
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileV2RsaToV3() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V2 to V3";
@@ -2122,7 +2122,7 @@ public void testReEncryptInstructionFileV2RsaToV3() {
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileUpgradesV1AesToV3() {
final String input =
"Testing re-encryption of instruction file, upgrading legacy V1 AES to V3";
@@ -2265,7 +2265,7 @@ public void testReEncryptInstructionFileUpgradesV1AesToV3() {
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileWithCustomSuffixUpgradesV1RsaToV3()
throws IOException {
final String input =
@@ -2444,7 +2444,7 @@ public void testReEncryptInstructionFileWithCustomSuffixUpgradesV1RsaToV3()
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileUpgradesV1RsaToV3() {
final String input =
"Testing re-encryption of instruction file, upgrading legacy V1 RSA to V3";
@@ -2608,7 +2608,7 @@ public void testReEncryptInstructionFileUpgradesV1RsaToV3() {
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileUpgradesV1AesEncryptionOnlyToV3() {
final String input =
"Testing re-encryption of instruction file, upgrading legacy V1 Encryption Only AES to V3";
@@ -2765,7 +2765,7 @@ public void testReEncryptInstructionFileUpgradesV1AesEncryptionOnlyToV3() {
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileWithCustomSuffixUpgradesV1RsaEncryptionOnlyToV3()
throws IOException {
final String input =
@@ -2956,7 +2956,7 @@ public void testReEncryptInstructionFileWithCustomSuffixUpgradesV1RsaEncryptionO
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testReEncryptInstructionFileUpgradesV1RsaEncryptionOnlyToV3()
throws IOException {
final String input =
@@ -3133,7 +3133,7 @@ public void testReEncryptInstructionFileUpgradesV1RsaEncryptionOnlyToV3()
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileEnforceRotation() {
AesKeyring oldKeyring = AesKeyring
.builder()
@@ -3197,7 +3197,7 @@ public void testAesKeyringReEncryptInstructionFileEnforceRotation() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileEnforceRotationWithSameKey() {
AesKeyring oldKeyring = AesKeyring
.builder()
@@ -3267,7 +3267,7 @@ public void testAesKeyringReEncryptInstructionFileEnforceRotationWithSameKey() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileEnforceRotation() {
PublicKey originalPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey originalPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -3349,7 +3349,7 @@ public void testRsaKeyringReEncryptInstructionFileEnforceRotation() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileEnforceRotationWithSameKey() {
PublicKey originalPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey originalPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -3428,7 +3428,7 @@ public void testRsaKeyringReEncryptInstructionFileEnforceRotationWithSameKey() {
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixEnforceRotation() {
PublicKey clientPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey clientPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -3519,7 +3519,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixEnforceRotatio
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixEnforceRotationWithSameKey() {
PublicKey clientPublicKey = RSA_KEY_PAIR.getPublic();
PrivateKey clientPrivateKey = RSA_KEY_PAIR.getPrivate();
@@ -3607,7 +3607,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixEnforceRotatio
deleteObject(BUCKET, objectKey, client);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileV1ToV3UpgradeEnforceRotation() {
final String objectKey = appendTestSuffix(
"v1-aes-to-v3-re-encrypt-instruction-file-with-enforce-rotation-test"
@@ -3713,7 +3713,7 @@ public void testAesKeyringReEncryptInstructionFileV1ToV3UpgradeEnforceRotation()
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileV1ToV3UpgradeEnforceRotationWithSameKey() {
final String objectKey = appendTestSuffix(
"v1-aes-to-v3-re-encrypt-instruction-file-with-enforce-rotation-same-key-test"
@@ -3825,7 +3825,7 @@ public void testAesKeyringReEncryptInstructionFileV1ToV3UpgradeEnforceRotationWi
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileV2ToV3EnforceRotationWithSameKey() {
final String objectKey = appendTestSuffix(
"v2-aes-to-v3-re-encrypt-instruction-file-with-enforce-rotation-same-key-test"
@@ -3924,7 +3924,7 @@ public void testAesKeyringReEncryptInstructionFileV2ToV3EnforceRotationWithSameK
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileV2ToV3EnforceRotation() {
final String objectKey = appendTestSuffix(
"v2-aes-to-v3-re-encrypt-instruction-file-with-enforce-rotation-test"
@@ -4017,7 +4017,7 @@ public void testAesKeyringReEncryptInstructionFileV2ToV3EnforceRotation() {
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV2ToV3EnforceRotation() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V2 to V3";
@@ -4124,7 +4124,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV2ToV3EnforceR
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV2ToV3EnforceRotationWithSameKey() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V2 to V3";
@@ -4228,7 +4228,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV2ToV3EnforceR
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileV2ToV3EnforceRotation() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V2 to V3";
@@ -4324,7 +4324,7 @@ public void testRsaKeyringReEncryptInstructionFileV2ToV3EnforceRotation() {
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileV2ToV3EnforceRotationWithSameKey() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V2 to V3";
@@ -4417,7 +4417,7 @@ public void testRsaKeyringReEncryptInstructionFileV2ToV3EnforceRotationWithSameK
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotation() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -4527,7 +4527,7 @@ public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotation() {
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotationWithSameKey() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -4634,7 +4634,7 @@ public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotationWithSameK
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceRotation() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -4745,7 +4745,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceR
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceRotationWithSameKey() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -4853,7 +4853,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceR
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceRotationEncryptionOnly() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -4964,7 +4964,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceR
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceRotationWithSameKeyEncryptionOnly() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -5072,7 +5072,7 @@ public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixV1ToV3EnforceR
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotationEncryptionOnly() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -5182,7 +5182,7 @@ public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotationEncryptio
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotationWithSameKeyEncryptionOnly() {
final String input =
"Testing re-encryption of instruction file with RSA keyrings from V1 to V3";
@@ -5289,7 +5289,7 @@ public void testRsaKeyringReEncryptInstructionFileV1ToV3EnforceRotationWithSameK
deleteObject(BUCKET, objectKey, v3OriginalClient);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileV1ToV3UpgradeEnforceRotationEncryptionOnly() {
final String objectKey = appendTestSuffix(
"v1-aes-to-v3-re-encrypt-instruction-file-with-enforce-rotation-encryption-only-test"
@@ -5395,7 +5395,7 @@ public void testAesKeyringReEncryptInstructionFileV1ToV3UpgradeEnforceRotationEn
deleteObject(BUCKET, objectKey, v3RotatedClient);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileV1ToV3UpgradeEnforceRotationWithSameKeyEncryptionOnly() {
final String objectKey = appendTestSuffix(
"v1-aes-to-v3-re-encrypt-instruction-file-with-enforce-rotation-same-key-encryption-only-test"
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileWithAdditionalDecryptionMaterialsTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileWithAdditionalDecryptionMaterialsTest.java
index 315516add..5d6d09ee8 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileWithAdditionalDecryptionMaterialsTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientReEncryptInstructionFileWithAdditionalDecryptionMaterialsTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.protocols.jsoncore.JsonNode;
@@ -76,7 +76,7 @@ public static void setUp() throws NoSuchAlgorithmException {
* This test encrypts an object with AES_KEY_1, then uses a client with AES_KEY_2 as the primary key
* but with additionalDecryptionMaterials containing AES_KEY_1 to re-encrypt the instruction file.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyringReEncryptInstructionFileWithAdditionalDecryptionMaterials() {
// Create materials descriptions
MaterialsDescription originalMatDesc = MaterialsDescription.builder()
@@ -245,7 +245,7 @@ public void testAesKeyringReEncryptInstructionFileWithAdditionalDecryptionMateri
* This test encrypts an object with RSA_KEY_PAIR_1, then uses a client with RSA_KEY_PAIR_2 as the primary key
* but with additionalDecryptionMaterials containing RSA_KEY_PAIR_1 to re-encrypt the instruction file.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithAdditionalDecryptionMaterials() {
// Create materials descriptions
MaterialsDescription originalMatDesc = MaterialsDescription.builder()
@@ -430,7 +430,7 @@ public void testRsaKeyringReEncryptInstructionFileWithAdditionalDecryptionMateri
* This test encrypts an object with RSA_KEY_PAIR_1, then uses a client with RSA_KEY_PAIR_2 as the primary key
* but with additionalDecryptionMaterials containing RSA_KEY_PAIR_1 to re-encrypt the instruction file with a custom suffix.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyringReEncryptInstructionFileWithCustomSuffixAndAdditionalDecryptionMaterials() {
// Create materials descriptions
MaterialsDescription originalMatDesc = MaterialsDescription.builder()
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRsaKeyPairTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRsaKeyPairTest.java
index 059f21086..51761a470 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRsaKeyPairTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientRsaKeyPairTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.services.s3.S3Client;
@@ -32,7 +32,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void RsaPublicAndPrivateKeys() {
final String objectKey = appendTestSuffix("rsa-public-and-private");
@@ -59,7 +59,7 @@ public void RsaPublicAndPrivateKeys() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaPrivateKeyCanOnlyDecrypt() {
final String objectKey = appendTestSuffix("rsa-private-key-only");
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -92,7 +92,7 @@ public void RsaPrivateKeyCanOnlyDecrypt() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void RsaPublicKeyCanOnlyEncrypt() {
final String objectKey = appendTestSuffix("rsa-public-key-only");
S3Client s3Client = S3EncryptionClient.builderV4()
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientStreamTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientStreamTest.java
index 2756c7acf..075bc5365 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientStreamTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientStreamTest.java
@@ -12,7 +12,7 @@
import org.apache.commons.io.IOUtils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.async.AsyncRequestBody;
@@ -71,7 +71,7 @@ public static void setUp() throws NoSuchAlgorithmException {
AES_KEY = keyGen.generateKey();
}
- @Test
+ @RetryingTest(3)
public void markResetInputStreamV3Encrypt() throws IOException {
final String objectKey = appendTestSuffix("markResetInputStreamV3Encrypt");
// V3 Client
@@ -103,7 +103,7 @@ public void markResetInputStreamV3Encrypt() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void ordinaryInputStreamV3Encrypt() throws IOException {
final String objectKey = appendTestSuffix("ordinaryInputStreamV3Encrypt");
@@ -137,7 +137,7 @@ public void ordinaryInputStreamV3Encrypt() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void ordinaryInputStreamV3UnboundedAsync() {
try (S3AsyncClient s3AsyncEncryptionClient = S3AsyncEncryptionClient.builderV4()
.commitmentPolicy(CommitmentPolicy.FORBID_ENCRYPT_ALLOW_DECRYPT)
@@ -156,7 +156,7 @@ public void ordinaryInputStreamV3UnboundedAsync() {
}
}
- @Test
+ @RetryingTest(3)
public void ordinaryInputStreamV3UnboundedMultipartAsync() {
try (S3AsyncClient s3AsyncEncryptionClient = S3AsyncEncryptionClient.builderV4()
.aesKey(AES_KEY)
@@ -175,7 +175,7 @@ public void ordinaryInputStreamV3UnboundedMultipartAsync() {
}
}
- @Test
+ @RetryingTest(3)
public void ordinaryInputStreamV3UnboundedCrt() {
try (S3AsyncClient s3CrtAsyncClient = S3AsyncClient.crtCreate()) {
try (S3AsyncClient s3AsyncEncryptionClient = S3AsyncEncryptionClient.builderV4()
@@ -197,7 +197,7 @@ public void ordinaryInputStreamV3UnboundedCrt() {
}
}
- @Test
+ @RetryingTest(3)
public void ordinaryInputStreamV3Decrypt() throws IOException {
final String objectKey = appendTestSuffix("ordinaryInputStreamV3Decrypt");
@@ -233,7 +233,7 @@ public void ordinaryInputStreamV3Decrypt() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void ordinaryInputStreamV3DecryptCbc() throws IOException {
final String objectKey = appendTestSuffix("markResetInputStreamV3DecryptCbc");
@@ -276,7 +276,7 @@ public void ordinaryInputStreamV3DecryptCbc() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void invalidBufferSize() {
assertThrows(S3EncryptionClientException.class, () -> S3EncryptionClient.builderV4()
.kmsKeyId(KMS_KEY_ID)
@@ -298,7 +298,7 @@ public void invalidBufferSize() {
.build());
}
- @Test
+ @RetryingTest(3)
public void failsWhenBothBufferSizeAndDelayedAuthModeEnabled() {
assertThrows(S3EncryptionClientException.class, () -> S3EncryptionClient.builderV4()
.kmsKeyId(KMS_KEY_ID)
@@ -313,7 +313,7 @@ public void failsWhenBothBufferSizeAndDelayedAuthModeEnabled() {
.build());
}
- @Test
+ @RetryingTest(3)
public void customSetBufferSizeWithLargeObject() throws IOException {
final String objectKey = appendTestSuffix("large-object-test-custom-buffer-size");
@@ -369,7 +369,7 @@ public void customSetBufferSizeWithLargeObject() throws IOException {
s3ClientWithDelayedAuth.close();
}
- @Test
+ @RetryingTest(3)
public void customSetBufferSizeWithLargeObjectAsyncClient() throws IOException {
final String objectKey = appendTestSuffix("large-object-test-custom-buffer-size-async");
@@ -429,7 +429,7 @@ public void customSetBufferSizeWithLargeObjectAsyncClient() throws IOException {
s3ClientWithDelayedAuth.close();
}
- @Test
+ @RetryingTest(3)
public void delayedAuthModeWithLargeObject() throws IOException {
final String objectKey = appendTestSuffix("large-object-test");
@@ -488,7 +488,7 @@ public void delayedAuthModeWithLargeObject() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void delayedAuthModeWithLargerThanMaxObjectFails() throws IOException {
final String objectKey = appendTestSuffix("larger-than-max-object-delayed-auth-mode");
@@ -514,7 +514,7 @@ public void delayedAuthModeWithLargerThanMaxObjectFails() throws IOException {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void AesGcmV3toV3StreamWithTamperedTag() {
final String objectKey = appendTestSuffix("aes-gcm-v3-to-v3-stream-tamper-tag");
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTest.java
index 906bb2f49..ea46b7e1d 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTest.java
@@ -17,7 +17,7 @@
import com.amazonaws.services.s3.model.StaticEncryptionMaterialsProvider;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.AwsSessionCredentials;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
@@ -116,7 +116,7 @@ public static void setUp() throws NoSuchAlgorithmException {
//= specification/s3-encryption/client.md#aws-sdk-compatibility
//= type=test
//# The S3EC SHOULD support invoking operations unrelated to client-side encryption e.g. CopyObject as the conventional AWS SDK S3 client would.
- @Test
+ @RetryingTest(3)
public void copyObjectTransparently() {
final String objectKey = appendTestSuffix("copy-object-from-here");
final String newObjectKey = appendTestSuffix("copy-object-to-here");
@@ -153,7 +153,7 @@ public void copyObjectTransparently() {
s3EncryptionClient.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectWithInstructionFileSuccess() {
final String objectKey = appendTestSuffix("delete-object-with-instruction-file");
@@ -200,7 +200,7 @@ public void deleteObjectWithInstructionFileSuccess() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectsWithInstructionFilesSuccess() {
final String[] objectKeys = {appendTestSuffix("delete-object-with-instruction-file-1"),
appendTestSuffix("delete-object-with-instruction-file-2"),
@@ -255,7 +255,7 @@ public void deleteObjectsWithInstructionFilesSuccess() {
defaultClient.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectWithWrongObjectKeySuccess() {
// V3 Client
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -267,7 +267,7 @@ public void deleteObjectWithWrongObjectKeySuccess() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectWithWrongBucketFailure() {
// V3 Client
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -283,7 +283,7 @@ public void deleteObjectWithWrongBucketFailure() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void deleteObjectsWithWrongBucketFailure() {
// V3 Client
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -300,7 +300,7 @@ public void deleteObjectsWithWrongBucketFailure() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void getNonExistentObject() {
final String objectKey = appendTestSuffix("this-is-not-an-object-key");
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -329,7 +329,7 @@ public void getNonExistentObject() {
//= specification/s3-encryption/client.md#cryptographic-materials
//= type=test
//# The S3EC MUST accept either one CMM or one Keyring instance upon initialization.
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithMultipleKeyringsFails() {
assertThrows(S3EncryptionClientException.class, () -> S3EncryptionClient.builderV4()
.aesKey(AES_KEY)
@@ -340,7 +340,7 @@ public void s3EncryptionClientWithMultipleKeyringsFails() {
//= specification/s3-encryption/client.md#cryptographic-materials
//= type=test
//# If both a CMM and a Keyring are provided, the S3EC MUST throw an exception.
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithCMMAndKeyringFails() {
CryptographicMaterialsManager defaultCMM = DefaultCryptoMaterialsManager.builder()
.keyring(RsaKeyring.builder()
@@ -353,20 +353,20 @@ public void s3EncryptionClientWithCMMAndKeyringFails() {
.build());
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithNoKeyringsFails() {
assertThrows(S3EncryptionClientException.class, () -> S3EncryptionClient.builderV4()
.build());
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithNoLegacyKeyringsFails() {
assertThrows(S3EncryptionClientException.class, () -> S3EncryptionClient.builderV4()
.enableLegacyWrappingAlgorithms(true)
.build());
}
- @Test
+ @RetryingTest(3)
public void testDefaultContentMetadataStorage() {
final String objectKey = appendTestSuffix("test-default-content-metadata-storage");
@@ -412,7 +412,7 @@ public void testDefaultContentMetadataStorage() {
v4Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsWithAliasARN() {
final String objectKey = appendTestSuffix("kms-with-alias-arn");
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -426,7 +426,7 @@ public void KmsWithAliasARN() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsWithShortKeyId() {
final String objectKey = appendTestSuffix("kms-with-short-key-id");
// Just assume the ARN is well-formed
@@ -444,7 +444,7 @@ public void KmsWithShortKeyId() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void KmsAliasARNToKeyId() {
final String objectKey = appendTestSuffix("kms-alias-arn-to-key-id");
S3Client aliasClient = S3EncryptionClient.builderV4()
@@ -480,7 +480,7 @@ public void KmsAliasARNToKeyId() {
keyIdClient.close();
}
- @Test
+ @RetryingTest(3)
public void AesKeyringWithInvalidAesKey() throws NoSuchAlgorithmException {
SecretKey invalidAesKey;
KeyGenerator keyGen = KeyGenerator.getInstance("DES");
@@ -492,7 +492,7 @@ public void AesKeyringWithInvalidAesKey() throws NoSuchAlgorithmException {
.build());
}
- @Test
+ @RetryingTest(3)
public void RsaKeyringWithInvalidRsaKey() throws NoSuchAlgorithmException {
KeyPair invalidRsaKey;
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("EC");
@@ -504,7 +504,7 @@ public void RsaKeyringWithInvalidRsaKey() throws NoSuchAlgorithmException {
.build());
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithKeyringFromKmsKeyIdSucceeds() {
final String objectKey = appendTestSuffix("keyring-from-kms-key-id");
@@ -525,7 +525,7 @@ public void s3EncryptionClientWithKeyringFromKmsKeyIdSucceeds() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithCmmFromKmsKeyIdSucceeds() {
final String objectKey = appendTestSuffix("cmm-from-kms-key-id");
@@ -549,7 +549,7 @@ public void s3EncryptionClientWithCmmFromKmsKeyIdSucceeds() {
//= specification/s3-encryption/client.md#wrapped-s3-client-s
//= type=test
//# The S3EC MUST support the option to provide an SDK S3 client instance during its initialization.
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithWrappedS3ClientSucceeds() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-kms-key-id");
@@ -579,7 +579,7 @@ public void s3EncryptionClientWithWrappedS3ClientSucceeds() {
* S3EncryptionClient implements S3Client, so it can be passed into the builder as a wrappedClient.
* However, is not a supported use case, and the builder should throw an exception if this happens.
*/
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithWrappedS3EncryptionClientFails() {
S3AsyncClient wrappedAsyncClient = S3AsyncEncryptionClient.builderV4()
.kmsKeyId(KMS_KEY_ID)
@@ -591,7 +591,7 @@ public void s3EncryptionClientWithWrappedS3EncryptionClientFails() {
.build());
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithNullSecureRandomFails() {
assertThrows(S3EncryptionClientException.class, () -> S3EncryptionClient.builderV4()
.aesKey(AES_KEY)
@@ -599,7 +599,7 @@ public void s3EncryptionClientWithNullSecureRandomFails() {
.build());
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithSecureRandom() {
SecureRandom secureRandom = new SecureRandom();
S3EncryptionClient s3EncryptionClient = S3EncryptionClient.builderV4()
@@ -612,7 +612,7 @@ public void s3EncryptionClientWithSecureRandom() {
s3EncryptionClient.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientFromKMSKeyDoesNotUseUnprovidedSecureRandom() {
SecureRandom mockSecureRandom = mock(SecureRandom.class, withSettings().withoutAnnotations());
@@ -631,7 +631,7 @@ public void s3EncryptionClientFromKMSKeyDoesNotUseUnprovidedSecureRandom() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void cryptoProviderV3toV3Enabled() {
final String objectKey = appendTestSuffix("crypto-provider-enabled-v3-to-v3");
@@ -660,7 +660,7 @@ public void cryptoProviderV3toV3Enabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void cryptoProviderV2toV3Enabled() {
final String objectKey = appendTestSuffix("crypto-provider-enabled-v2-to-v3");
@@ -699,7 +699,7 @@ public void cryptoProviderV2toV3Enabled() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void contentLengthRequest() {
final String objectKey = appendTestSuffix("content-length");
@@ -729,7 +729,7 @@ public void contentLengthRequest() {
s3EncryptionClient.close();
}
- @Test
+ @RetryingTest(3)
public void attemptToDecryptPlaintext() {
final String objectKey = appendTestSuffix("plaintext-object");
@@ -761,7 +761,7 @@ public void attemptToDecryptPlaintext() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void createMultipartUploadFailure() {
// V3 Client
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -777,7 +777,7 @@ public void createMultipartUploadFailure() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void uploadPartFailure() {
final String objectKey = appendTestSuffix("upload-part-failure");
// V3 Client
@@ -810,7 +810,7 @@ public void uploadPartFailure() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void completeMultipartUploadFailure() {
// V3 Client
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -826,7 +826,7 @@ public void completeMultipartUploadFailure() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void abortMultipartUploadFailure() {
final String objectKey = appendTestSuffix("abort-multipart-failure");
@@ -845,7 +845,7 @@ public void abortMultipartUploadFailure() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientWithCustomCredentials() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-custom-credentials");
@@ -885,7 +885,7 @@ public void s3EncryptionClientWithCustomCredentials() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientTopLevelAllOptions() {
final String objectKey = appendTestSuffix("s3-client-with-all-top-level-options");
AwsCredentialsProvider creds = DefaultCredentialsProvider.create();
@@ -919,7 +919,7 @@ public void s3EncryptionClientTopLevelAllOptions() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientTopLevelCredentials() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-top-level-credentials");
@@ -939,7 +939,7 @@ public void s3EncryptionClientTopLevelCredentials() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientTopLevelCredentialsWrongRegion() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-top-level-credentials");
@@ -964,7 +964,7 @@ public void s3EncryptionClientTopLevelCredentialsWrongRegion() {
}
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientTopLevelCredentialsNullCreds() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-null-credentials");
@@ -994,7 +994,7 @@ public void s3EncryptionClientTopLevelCredentialsNullCreds() {
//= specification/s3-encryption/client.md#inherited-sdk-configuration
//= type=test
//# If the S3EC accepts SDK client configuration, the configuration MUST be applied to all wrapped SDK clients including the KMS client.
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientTopLevelAlternateCredentials() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-top-level-credentials");
@@ -1033,7 +1033,7 @@ public void s3EncryptionClientTopLevelAlternateCredentials() {
s3ClientAltCreds.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientMixedCredentials() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-mixed-credentials");
@@ -1061,7 +1061,7 @@ public void s3EncryptionClientMixedCredentials() {
kmsClient.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientMixedCredentialsInstructionFile() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-mixed-credentials-instruction-file");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -1117,7 +1117,7 @@ public void s3EncryptionClientMixedCredentialsInstructionFile() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void s3EncryptionClientMixedCredentialsInstructionFileFails() {
final String objectKey = appendTestSuffix("wrapped-s3-client-with-mixed-credentials-instruction-file-fails");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -1166,7 +1166,7 @@ public void s3EncryptionClientMixedCredentialsInstructionFileFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void NonUSASCIIMetadataFails() {
final String objectKey = appendTestSuffix("non-us-ascii-metadata-fails");
final String input = "This is a test.";
@@ -1192,7 +1192,7 @@ public void NonUSASCIIMetadataFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testInstructionFileConfig() {
final String objectKey = appendTestSuffix("instruction-file-config");
final String input = "SimpleTestOfV3EncryptionClient";
@@ -1252,7 +1252,7 @@ public void testInstructionFileConfig() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testSimpleKCRoundTrip() {
final String objectKey = appendTestSuffix("simple-kc-roundtrip");
S3Client s3Client = S3EncryptionClient.builderV4()
@@ -1272,7 +1272,7 @@ public void testSimpleKCRoundTrip() {
}
- @Test
+ @RetryingTest(3)
public void testRejectNonCommitting() {
final String objectKey = appendTestSuffix("kc-reject-non-committing");
S3Client s3ClientPutsNonKC = S3EncryptionClient.builderV4()
diff --git a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTestVectorsTest.java b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTestVectorsTest.java
index 86b698326..427f88932 100644
--- a/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTestVectorsTest.java
+++ b/src/test/java/software/amazon/encryption/s3/S3EncryptionClientTestVectorsTest.java
@@ -1,6 +1,6 @@
package software.amazon.encryption.s3;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
@@ -22,7 +22,7 @@ public class S3EncryptionClientTestVectorsTest {
//= specification/s3-encryption/data-format/metadata-strategy.md#object-metadata
//= type=test
//# The S3EC SHOULD support decoding the S3 Server's "double encoding".
- @Test
+ @RetryingTest(3)
public void decryptUnicodeTestVectors() {
S3Client s3EncryptionClient = S3EncryptionClient.builderV4()
.kmsKeyId(TESTVECTORS_KMS_KEY)
diff --git a/src/test/java/software/amazon/encryption/s3/algorithms/AlgorithmSuiteValidationTest.java b/src/test/java/software/amazon/encryption/s3/algorithms/AlgorithmSuiteValidationTest.java
index 1473710e2..92b7db6d4 100644
--- a/src/test/java/software/amazon/encryption/s3/algorithms/AlgorithmSuiteValidationTest.java
+++ b/src/test/java/software/amazon/encryption/s3/algorithms/AlgorithmSuiteValidationTest.java
@@ -8,7 +8,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
@@ -27,7 +27,7 @@ public void testAlgorithmSuiteProperties(AlgorithmSuite suite) {
assertNotNull(suite.dataKeyAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testLegacyAlgorithmIdentification() {
assertTrue(AlgorithmSuite.ALG_AES_256_CBC_IV16_NO_KDF.isLegacy());
assertTrue(AlgorithmSuite.ALG_AES_256_CTR_IV16_TAG16_NO_KDF.isLegacy());
@@ -35,7 +35,7 @@ public void testLegacyAlgorithmIdentification() {
assertFalse(AlgorithmSuite.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY.isLegacy());
}
- @Test
+ @RetryingTest(3)
public void testCommittingAlgorithmIdentification() {
assertTrue(AlgorithmSuite.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY.isCommitting());
assertTrue(AlgorithmSuite.ALG_AES_256_CTR_HKDF_SHA512_COMMIT_KEY.isCommitting());
@@ -43,7 +43,7 @@ public void testCommittingAlgorithmIdentification() {
assertFalse(AlgorithmSuite.ALG_AES_256_CBC_IV16_NO_KDF.isCommitting());
}
- @Test
+ @RetryingTest(3)
public void testAlgorithmSuiteIdConversions() {
for (AlgorithmSuite suite : AlgorithmSuite.values()) {
assertEquals(String.valueOf(suite.id()), suite.idAsString());
@@ -54,7 +54,7 @@ public void testAlgorithmSuiteIdConversions() {
}
}
- @Test
+ @RetryingTest(3)
public void testContentLengthLimits() {
// Test that GCM algorithms have appropriate limits
assertTrue(AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF.cipherMaxContentLengthBytes() > 0);
@@ -67,7 +67,7 @@ public void testContentLengthLimits() {
);
}
- @Test
+ @RetryingTest(3)
public void testAlgorithmSuiteSpecificProperties() {
// Test AES-256-GCM-IV12-TAG16-NO-KDF properties
AlgorithmSuite gcmNoKdf = AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF;
@@ -100,7 +100,7 @@ public void testAlgorithmSuiteSpecificProperties() {
assertFalse(cbc.isCommitting());
}
- @Test
+ @RetryingTest(3)
public void testAlgorithmSuiteUniqueIds() {
AlgorithmSuite[] suites = AlgorithmSuite.values();
for (int i = 0; i < suites.length; i++) {
diff --git a/src/test/java/software/amazon/encryption/s3/examples/AsyncClientExampleTest.java b/src/test/java/software/amazon/encryption/s3/examples/AsyncClientExampleTest.java
index 1005086d7..142713dc3 100644
--- a/src/test/java/software/amazon/encryption/s3/examples/AsyncClientExampleTest.java
+++ b/src/test/java/software/amazon/encryption/s3/examples/AsyncClientExampleTest.java
@@ -1,13 +1,13 @@
package software.amazon.encryption.s3.examples;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
import static org.junit.jupiter.api.Assertions.fail;
public class AsyncClientExampleTest {
- @Test
+ @RetryingTest(3)
public void testAsyncClientExamples() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
try {
diff --git a/src/test/java/software/amazon/encryption/s3/examples/ClientConfigurationExampleTest.java b/src/test/java/software/amazon/encryption/s3/examples/ClientConfigurationExampleTest.java
index 7dc06eb33..b291cc11b 100644
--- a/src/test/java/software/amazon/encryption/s3/examples/ClientConfigurationExampleTest.java
+++ b/src/test/java/software/amazon/encryption/s3/examples/ClientConfigurationExampleTest.java
@@ -1,11 +1,11 @@
package software.amazon.encryption.s3.examples;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import static org.junit.jupiter.api.Assertions.fail;
public class ClientConfigurationExampleTest {
- @Test
+ @RetryingTest(3)
public void testClientConfigurationExamples() {
try {
ClientConfigurationExample.main(new String[0]);
diff --git a/src/test/java/software/amazon/encryption/s3/examples/InstructionFileExampleTest.java b/src/test/java/software/amazon/encryption/s3/examples/InstructionFileExampleTest.java
index 22b7543bf..6962b9898 100644
--- a/src/test/java/software/amazon/encryption/s3/examples/InstructionFileExampleTest.java
+++ b/src/test/java/software/amazon/encryption/s3/examples/InstructionFileExampleTest.java
@@ -1,13 +1,13 @@
package software.amazon.encryption.s3.examples;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
import static org.junit.jupiter.api.Assertions.fail;
public class InstructionFileExampleTest {
- @Test
+ @RetryingTest(3)
public void testInstructionFileExample() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
final String kmsKeyId = S3EncryptionClientTestResources.KMS_KEY_ID;
diff --git a/src/test/java/software/amazon/encryption/s3/examples/MultipartUploadExampleTest.java b/src/test/java/software/amazon/encryption/s3/examples/MultipartUploadExampleTest.java
index f037f640d..274e82253 100644
--- a/src/test/java/software/amazon/encryption/s3/examples/MultipartUploadExampleTest.java
+++ b/src/test/java/software/amazon/encryption/s3/examples/MultipartUploadExampleTest.java
@@ -1,13 +1,13 @@
package software.amazon.encryption.s3.examples;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
import static org.junit.jupiter.api.Assertions.fail;
public class MultipartUploadExampleTest {
- @Test
+ @RetryingTest(3)
public void testMultipartUploadExamples() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
try {
diff --git a/src/test/java/software/amazon/encryption/s3/examples/PartialKeyPairExampleTest.java b/src/test/java/software/amazon/encryption/s3/examples/PartialKeyPairExampleTest.java
index df0babad1..83315dcc0 100644
--- a/src/test/java/software/amazon/encryption/s3/examples/PartialKeyPairExampleTest.java
+++ b/src/test/java/software/amazon/encryption/s3/examples/PartialKeyPairExampleTest.java
@@ -2,14 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
package software.amazon.encryption.s3.examples;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
import static org.junit.jupiter.api.Assertions.fail;
public class PartialKeyPairExampleTest {
- @Test
+ @RetryingTest(3)
public void testPartialKeyPairExamples() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
try {
diff --git a/src/test/java/software/amazon/encryption/s3/examples/RangedGetExampleTest.java b/src/test/java/software/amazon/encryption/s3/examples/RangedGetExampleTest.java
index ec4b24541..ca0898c2f 100644
--- a/src/test/java/software/amazon/encryption/s3/examples/RangedGetExampleTest.java
+++ b/src/test/java/software/amazon/encryption/s3/examples/RangedGetExampleTest.java
@@ -1,13 +1,13 @@
package software.amazon.encryption.s3.examples;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
import static org.junit.jupiter.api.Assertions.fail;
public class RangedGetExampleTest {
- @Test
+ @RetryingTest(3)
public void testRangedGetExamples() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
try {
diff --git a/src/test/java/software/amazon/encryption/s3/examples/ReEncryptInstructionFileExampleTest.java b/src/test/java/software/amazon/encryption/s3/examples/ReEncryptInstructionFileExampleTest.java
index 62b677755..9bdfcdfaf 100644
--- a/src/test/java/software/amazon/encryption/s3/examples/ReEncryptInstructionFileExampleTest.java
+++ b/src/test/java/software/amazon/encryption/s3/examples/ReEncryptInstructionFileExampleTest.java
@@ -1,13 +1,13 @@
package software.amazon.encryption.s3.examples;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
import static org.junit.jupiter.api.Assertions.fail;
public class ReEncryptInstructionFileExampleTest {
- @Test
+ @RetryingTest(3)
public void testSimpleAesKeyringReEncryptInstructionFile() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
try {
@@ -18,7 +18,7 @@ public void testSimpleAesKeyringReEncryptInstructionFile() {
}
}
- @Test
+ @RetryingTest(3)
public void testSimpleRsaKeyringReEncryptInstructionFile() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
try {
@@ -29,7 +29,7 @@ public void testSimpleRsaKeyringReEncryptInstructionFile() {
}
}
- @Test
+ @RetryingTest(3)
public void testSimpleRsaKeyringReEncryptInstructionFileWithCustomSuffix() {
final String bucket = S3EncryptionClientTestResources.BUCKET;
try {
diff --git a/src/test/java/software/amazon/encryption/s3/internal/ApiNameVersionTest.java b/src/test/java/software/amazon/encryption/s3/internal/ApiNameVersionTest.java
index 8a596161f..697c772ce 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/ApiNameVersionTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/ApiNameVersionTest.java
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package software.amazon.encryption.s3.internal;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -12,7 +12,7 @@ public class ApiNameVersionTest {
private final static String EXPECTED_API_NAME = "AmazonS3Encrypt";
private final static String EXPECTED_API_MAJOR_VERSION = "4";
- @Test
+ @RetryingTest(3)
public void testApiNameWithVersion() {
assertEquals(EXPECTED_API_NAME, ApiNameVersion.apiNameWithVersion().name());
// To avoid having to hardcode versions, just check that we're incrementing from 3
diff --git a/src/test/java/software/amazon/encryption/s3/internal/CipherProviderTest.java b/src/test/java/software/amazon/encryption/s3/internal/CipherProviderTest.java
index 92fc79d89..d839ffbb9 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/CipherProviderTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/CipherProviderTest.java
@@ -21,7 +21,7 @@
import javax.crypto.spec.GCMParameterSpec;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.S3EncryptionClientException;
import software.amazon.encryption.s3.S3EncryptionClientSecurityException;
@@ -75,7 +75,7 @@ private DecryptionMaterials createDecryptionMaterials(AlgorithmSuite algorithmSu
.build();
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherWithCommittingAlgorithmValidMessageId() throws Exception {
//= specification/s3-encryption/encryption.md#cipher-initialization
//= type=test
@@ -93,7 +93,7 @@ public void testCreateAndInitCipherWithCommittingAlgorithmValidMessageId() throw
assertEquals("AES/GCM/NoPadding", cipher.getAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherWithCommittingAlgorithmZeroMessageId() throws Exception {
//= specification/s3-encryption/encryption.md#cipher-initialization
//= type=test
@@ -110,7 +110,7 @@ public void testCreateAndInitCipherWithCommittingAlgorithmZeroMessageId() throws
assertEquals("MessageId has not been initialized!", exception.getMessage());
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherWithNonCommittingAlgorithmValidIV() throws Exception {
//= specification/s3-encryption/encryption.md#cipher-initialization
//= type=test
@@ -128,7 +128,7 @@ public void testCreateAndInitCipherWithNonCommittingAlgorithmValidIV() throws Ex
assertEquals("AES/GCM/NoPadding", cipher.getAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherWithNonCommittingAlgorithmZeroIV() throws Exception {
//= specification/s3-encryption/encryption.md#cipher-initialization
//= type=test
@@ -144,7 +144,7 @@ public void testCreateAndInitCipherWithNonCommittingAlgorithmZeroIV() throws Exc
assertEquals("IV has not been initialized!", exception.getMessage());
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY() throws Exception {
//= specification/s3-encryption/encryption.md#alg-aes-256-gcm-hkdf-sha512-commit-key
//= type=test
@@ -171,7 +171,7 @@ public void testCreateAndInitCipherALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY() thro
assertNotNull(materials.getKeyCommitment());
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_GCM_IV12_TAG16_NO_KDF() throws Exception {
SecretKey dataKey = createTestDataKey(32);
CryptographicMaterials materials = createEncryptionMaterials(AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF, dataKey);
@@ -201,7 +201,7 @@ public void testCreateAndInitCipherALG_AES_256_GCM_IV12_TAG16_NO_KDF() throws Ex
assertArrayEquals(iv, params.getIV());
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_CTR_IV16_TAG16_NO_KDF_EncryptionFails() throws Exception {
//= specification/s3-encryption/encryption.md#alg-aes-256-ctr-iv16-tag16-no-kdf
//= type=test
@@ -218,7 +218,7 @@ public void testCreateAndInitCipherALG_AES_256_CTR_IV16_TAG16_NO_KDF_EncryptionF
assertTrue(exception.getMessage().contains("Encryption is not supported for algorithm"));
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_CTR_IV16_TAG16_NO_KDF_DecryptionSucceeds() throws Exception {
SecretKey dataKey = createTestDataKey(32);
CryptographicMaterials materials = createDecryptionMaterials(AlgorithmSuite.ALG_AES_256_CTR_IV16_TAG16_NO_KDF, dataKey, EMPTY_KEY_COMMITMENT);
@@ -233,7 +233,7 @@ public void testCreateAndInitCipherALG_AES_256_CTR_IV16_TAG16_NO_KDF_DecryptionS
assertEquals("AES/CTR/NoPadding", cipher.getAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_CTR_HKDF_SHA512_COMMIT_KEY_EncryptionFails() throws Exception {
//= specification/s3-encryption/encryption.md#alg-aes-256-ctr-hkdf-sha512-commit-key
//= type=test
@@ -250,7 +250,7 @@ public void testCreateAndInitCipherALG_AES_256_CTR_HKDF_SHA512_COMMIT_KEY_Encryp
assertTrue(exception.getMessage().contains("Encryption is not supported for algorithm"));
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_CTR_HKDF_SHA512_COMMIT_KEY_DecryptionSucceeds() throws Exception {
//= specification/s3-encryption/encryption.md#alg-aes-256-gcm-hkdf-sha512-commit-key
//= type=test
@@ -274,7 +274,7 @@ public void testCreateAndInitCipherALG_AES_256_CTR_HKDF_SHA512_COMMIT_KEY_Decryp
assertTrue(exception.getMessage().contains("Key commitment validation failed. The derived key commitment does not match the stored key commitment value. This indicates potential data tampering or corruption."));
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_CBC_IV16_NO_KDF_EncryptionFails() throws Exception {
SecretKey dataKey = createTestDataKey(32);
CryptographicMaterials materials = createEncryptionMaterials(AlgorithmSuite.ALG_AES_256_CBC_IV16_NO_KDF, dataKey);
@@ -288,7 +288,7 @@ public void testCreateAndInitCipherALG_AES_256_CBC_IV16_NO_KDF_EncryptionFails()
assertTrue(exception.getMessage().contains("Encryption is not supported for algorithm"));
}
- @Test
+ @RetryingTest(3)
public void testCreateAndInitCipherALG_AES_256_CBC_IV16_NO_KDF_DecryptionSucceeds() throws Exception {
SecretKey dataKey = createTestDataKey(32);
CryptographicMaterials materials = createDecryptionMaterials(AlgorithmSuite.ALG_AES_256_CBC_IV16_NO_KDF, dataKey, EMPTY_KEY_COMMITMENT);
@@ -303,7 +303,7 @@ public void testCreateAndInitCipherALG_AES_256_CBC_IV16_NO_KDF_DecryptionSucceed
assertEquals("AES/CBC/PKCS5Padding", cipher.getAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testKeyDerivationInputKeyMaterialLengthValidation() throws Exception {
//= specification/s3-encryption/key-derivation.md#hkdf-operation
//= type=test
@@ -321,7 +321,7 @@ public void testKeyDerivationInputKeyMaterialLengthValidation() throws Exception
assertEquals("Length of Input key material does not match the expected value!", exception.getMessage());
}
- @Test
+ @RetryingTest(3)
public void testKeyDerivationInputKeyMaterialLengthValidationDecryptionMaterials() throws Exception {
//= specification/s3-encryption/key-derivation.md#hkdf-operation
//= type=test
@@ -339,7 +339,7 @@ public void testKeyDerivationInputKeyMaterialLengthValidationDecryptionMaterials
assertEquals("Length of Input key material does not match the expected value!", exception.getMessage());
}
- @Test
+ @RetryingTest(3)
public void testKeyDerivationMessageIdLengthValidation() throws Exception {
//= specification/s3-encryption/key-derivation.md#hkdf-operation
//= type=test
@@ -356,7 +356,7 @@ public void testKeyDerivationMessageIdLengthValidation() throws Exception {
assertEquals("Length of Input Message ID does not match the expected value!", exception.getMessage());
}
- @Test
+ @RetryingTest(3)
public void testKeyDerivationMessageIdLengthValidationDecryptionMaterials() throws Exception {
//= specification/s3-encryption/key-derivation.md#hkdf-operation
//= type=test
@@ -373,7 +373,7 @@ public void testKeyDerivationMessageIdLengthValidationDecryptionMaterials() thro
assertEquals("Length of Input Message ID does not match the expected value!", exception.getMessage());
}
- @Test
+ @RetryingTest(3)
public void testKeyCommitmentVerification() throws Exception {
SecretKey dataKey = createTestDataKey(32);
@@ -420,7 +420,7 @@ public void testKeyCommitmentVerification() throws Exception {
exception.getCause().getMessage());
}
- @Test
+ @RetryingTest(3)
public void testKeyDerivationWithZeroIVForCommittingAlgorithm() throws Exception {
//= specification/s3-encryption/key-derivation.md#hkdf-operation
//= type=TODO
@@ -442,7 +442,7 @@ public void testKeyDerivationWithZeroIVForCommittingAlgorithm() throws Exception
assertTrue(MessageDigest.isEqual(FIXED_IV_FOR_COMMIT_ALG.clone(), actualIV));
}
- @Test
+ @RetryingTest(3)
public void testGenerateDerivedEncryptionKey() throws Exception {
SecretKey dataKey = createTestDataKey(32);
EncryptionMaterials materials = createEncryptionMaterials(AlgorithmSuite.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY, dataKey);
@@ -464,7 +464,7 @@ public void testGenerateDerivedEncryptionKey() throws Exception {
assertEquals(materials.algorithmSuite().dataKeyLengthBytes(), ek.getEncoded().length);
}
- @Test
+ @RetryingTest(3)
public void testKeyDerivationHashAlgorithmFromAlgorithmSuite() throws Exception {
//= specification/s3-encryption/key-derivation.md#hkdf-operation
//= type=test
@@ -484,7 +484,7 @@ public void testKeyDerivationHashAlgorithmFromAlgorithmSuite() throws Exception
assertEquals("AES/GCM/NoPadding", cipher.getAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testKeyCommitmentValidationBothSuccessAndFailurePaths() throws Exception {
//= specification/s3-encryption/decryption.md#decrypting-with-commitment
//= type=test
diff --git a/src/test/java/software/amazon/encryption/s3/internal/CipherSubscriberTest.java b/src/test/java/software/amazon/encryption/s3/internal/CipherSubscriberTest.java
index fa3b4367d..53fcbe24b 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/CipherSubscriberTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/CipherSubscriberTest.java
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package software.amazon.encryption.s3.internal;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import software.amazon.encryption.s3.algorithms.AlgorithmSuite;
@@ -191,7 +191,7 @@ private byte[] getByteArrayFromFixedLengthByteBuffers(List byteBuffe
return bytes;
}
- @Test
+ @RetryingTest(3)
public void testSubscriberBehaviorOneChunk() {
AlgorithmSuite algorithmSuite = AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF;
String plaintext = "unit test of cipher subscriber";
@@ -242,7 +242,7 @@ public void testSubscriberBehaviorOneChunk() {
assertEquals(plaintext, new String(ptBytes, StandardCharsets.UTF_8));
}
- @Test
+ @RetryingTest(3)
public void testSubscriberBehaviorTagLengthLastChunk() {
AlgorithmSuite algorithmSuite = AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF;
String plaintext = "unit test of cipher subscriber tag length last chunk";
diff --git a/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataStrategyTest.java b/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataStrategyTest.java
index eea456a09..c5c74471c 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataStrategyTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataStrategyTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.internal;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@@ -61,7 +61,7 @@ public void setUp() {
.build();
}
- @Test
+ @RetryingTest(3)
public void testDetectV1Format() {
//= specification/s3-encryption/data-format/content-metadata.md#determining-s3ec-object-status
//= type=test
@@ -80,7 +80,7 @@ public void testDetectV1Format() {
}
- @Test
+ @RetryingTest(3)
public void testV3WithEncryptionContext() {
//= specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
//= type=test
@@ -110,7 +110,7 @@ public void testV3WithEncryptionContext() {
assertEquals("test-key-id", result.encryptionContext().get("kms_cmk_id"));
}
- @Test
+ @RetryingTest(3)
public void testV3AesWithMaterialDescription() {
//= specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
//= type=test
@@ -140,7 +140,7 @@ public void testV3AesWithMaterialDescription() {
assertEquals("material-desc", result.materialsDescription().get("test"));
}
- @Test
+ @RetryingTest(3)
public void testV3RsaWithMaterialDescription() {
//= specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
//= type=test
@@ -170,7 +170,7 @@ public void testV3RsaWithMaterialDescription() {
assertEquals("material-desc", result.materialsDescription().get("test"));
}
- @Test
+ @RetryingTest(3)
public void testV3WithoutMaterialDescriptionInMetatadata() {
Map metadata = new HashMap<>();
metadata.put("x-amz-c", "115");
@@ -193,7 +193,7 @@ public void testV3WithoutMaterialDescriptionInMetatadata() {
result.encryptedDataKey().keyProviderInfo());
}
- @Test
+ @RetryingTest(3)
public void testRangedGetV3() {
//= specification/s3-encryption/decryption.md#ranged-gets
//= type=test
@@ -219,7 +219,7 @@ public void testRangedGetV3() {
assertEquals(AlgorithmSuite.ALG_AES_256_CTR_HKDF_SHA512_COMMIT_KEY, result.algorithmSuite());
}
- @Test
+ @RetryingTest(3)
public void testRangedGetV2() {
//= specification/s3-encryption/decryption.md#ranged-gets
//= type=test
@@ -242,7 +242,7 @@ public void testRangedGetV2() {
assertEquals(AlgorithmSuite.ALG_AES_256_CTR_IV16_TAG16_NO_KDF, result.algorithmSuite());
}
- @Test
+ @RetryingTest(3)
public void testV1LegacyInferAESFromCiphertextLength() {
// Test legacy V1 behavior where algorithm is inferred from ciphertext length
Map metadata = new HashMap<>();
@@ -259,7 +259,7 @@ public void testV1LegacyInferAESFromCiphertextLength() {
assertEquals("AES", result.encryptedDataKey().keyProviderInfo());
}
- @Test
+ @RetryingTest(3)
public void testV1LegacyInferRSAFromCiphertextLength() {
// Test legacy V1 behavior where algorithm is inferred from ciphertext length
Map metadata = new HashMap<>();
@@ -277,7 +277,7 @@ public void testV1LegacyInferRSAFromCiphertextLength() {
assertEquals("RSA", result.encryptedDataKey().keyProviderInfo());
}
- @Test
+ @RetryingTest(3)
public void testUnknownContentEncryptionAlgorithmV3() {
Map metadata = new HashMap<>();
metadata.put("x-amz-c", "999"); // Unknown algorithm
@@ -294,7 +294,7 @@ public void testUnknownContentEncryptionAlgorithmV3() {
assertTrue(exception.getMessage().contains("Unknown content encryption algorithm for V3 message format"));
}
- @Test
+ @RetryingTest(3)
public void testUnknownContentEncryptionAlgorithmV2() {
Map metadata = new HashMap<>();
metadata.put("x-amz-iv", "dGVzdC1pdi0xMi1i");
@@ -312,7 +312,7 @@ public void testUnknownContentEncryptionAlgorithmV2() {
assertTrue(exception.getMessage().contains("Unknown content encryption algorithm for V2 message format"));
}
- @Test
+ @RetryingTest(3)
public void testMissingKeysV3InstructionFile() {
Map objectMetadata = new HashMap<>();
objectMetadata.put("x-amz-c", "115");
@@ -341,7 +341,7 @@ public void testMissingKeysV3InstructionFile() {
assertTrue(exception.getMessage().contains("Content metadata is tampered, required metadata to decrypt the object are missing"));
}
- @Test
+ @RetryingTest(3)
public void testMissingKeysV3() {
Map metadata = new HashMap<>();
metadata.put("x-amz-c", "999"); // Unknown algorithm
@@ -362,7 +362,7 @@ public void testMissingKeysV3() {
assertTrue(exception.getMessage().contains("Content metadata is tampered, required metadata to decrypt the object are missing"));
}
- @Test
+ @RetryingTest(3)
public void testMissingKeysV2InstructionFile() {
Map instructionMetadata = new HashMap<>();
instructionMetadata.put("x-amz-iv", "dGVzdC1pdi0xMi1i");
@@ -389,7 +389,7 @@ public void testMissingKeysV2InstructionFile() {
assertTrue(exception.getMessage().contains("Content metadata is tampered, required metadata to decrypt the object are missing"));
}
- @Test
+ @RetryingTest(3)
public void testMissingKeysV2() {
Map metadata = new HashMap<>();
metadata.put("x-amz-iv", "dGVzdC1pdi0xMi1i");
@@ -411,7 +411,7 @@ public void testMissingKeysV2() {
assertTrue(exception.getMessage().contains("Content metadata is tampered, required metadata to decrypt the object are missing"));
}
- @Test
+ @RetryingTest(3)
public void testMissingKeysV1() {
Map metadata = new HashMap<>();
metadata.put("x-amz-iv", "dGVzdC1pdi0xMi1i");
@@ -430,7 +430,7 @@ public void testMissingKeysV1() {
assertTrue(exception.getMessage().contains("Content metadata is tampered, required metadata to decrypt the object are missing"));
}
- @Test
+ @RetryingTest(3)
public void testExclusiveKeysCollision() {
Map metadata = new HashMap<>();
metadata.put("x-amz-iv", "dGVzdC1pdi0xMi1i");
@@ -454,7 +454,7 @@ public void testExclusiveKeysCollision() {
assertTrue(exception.getMessage().contains("Content metadata is tampered, required metadata to decrypt the object are missing"));
}
- @Test
+ @RetryingTest(3)
public void testTagLengthValidationV2() {
Map metadata = new HashMap<>();
metadata.put("x-amz-iv", "dGVzdC1pdi0xMi1i");
@@ -620,7 +620,7 @@ public void testMetadataFormatDetection(Map metadata, String exp
// ========== ENCODING TESTS ==========
- @Test
+ @RetryingTest(3)
public void testEncodeMetadataV2GCM() {
// Test V2 metadata encoding similar to Go's TestEncodeMetaV2
EncryptedDataKey edk = EncryptedDataKey.builder()
@@ -673,7 +673,7 @@ public void testEncodeMetadataV2GCM() {
assertTrue(matDesc.contains("value"));
}
- @Test
+ @RetryingTest(3)
public void testEncodeMetaV2WithEmptyMaterialDescription() {
EncryptedDataKey edk = EncryptedDataKey.builder()
.encryptedDataKey("encrypted-key-data".getBytes(StandardCharsets.UTF_8))
@@ -701,7 +701,7 @@ public void testEncodeMetaV2WithEmptyMaterialDescription() {
assertEquals("{}", matDesc);
}
- @Test
+ @RetryingTest(3)
public void testDecodeMetadataV3GCMFromInstructionFile() {
//= specification/s3-encryption/data-format/content-metadata.md#content-metadata-mapkeys
//= type=test
@@ -784,7 +784,7 @@ private String metadataToString(Map metadataMap) {
}
}
- @Test
+ @RetryingTest(3)
public void testEncodeMetaV3WithAESGCM() {
// Test V3 encoding with AES/GCM wrapping algorithm
EncryptedDataKey edk = EncryptedDataKey.builder()
@@ -845,7 +845,7 @@ public void testEncodeMetaV3WithAESGCM() {
assertTrue(matDesc.contains("value"));
}
- @Test
+ @RetryingTest(3)
public void testEncodeMetaV3WithKMSContext() {
// Test V3 encoding with kms+context wrapping algorithm
EncryptedDataKey edk = EncryptedDataKey.builder()
@@ -893,7 +893,7 @@ public void testEncodeMetaV3WithKMSContext() {
assertTrue(encCtx.contains("value"));
}
- @Test
+ @RetryingTest(3)
public void testEncodeMetaV3WithRSAOAEP() {
// Test V3 encoding with RSA-OAEP-SHA1 wrapping algorithm
EncryptedDataKey edk = EncryptedDataKey.builder()
diff --git a/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataTest.java b/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataTest.java
index 5ef67479c..b8e7b0bbf 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/ContentMetadataTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.internal;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.algorithms.AlgorithmSuite;
import software.amazon.encryption.s3.materials.EncryptedDataKey;
@@ -39,28 +39,28 @@ public void setUp() {
.build();
}
- @Test
+ @RetryingTest(3)
public void testAlgorithmSuite() {
assertEquals(AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF, actualContentMetadata.algorithmSuite());
assertNotEquals(AlgorithmSuite.ALG_AES_256_CBC_IV16_NO_KDF, actualContentMetadata.algorithmSuite());
}
- @Test
+ @RetryingTest(3)
public void testEncryptedDataKey() {
assertEquals(encryptedDataKey, actualContentMetadata.encryptedDataKey());
}
- @Test
+ @RetryingTest(3)
public void testEncryptedDataKeyAlgorithm() {
assertEquals(encryptedDataKeyAlgorithm, actualContentMetadata.encryptedDataKeyAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testEncryptedDataKeyContext() {
assertEquals(encryptedDataKeyContext, actualContentMetadata.encryptionContext());
}
- @Test
+ @RetryingTest(3)
public void testContentIv() {
assertEquals(Arrays.toString(contentIv), Arrays.toString(actualContentMetadata.contentIv()));
}
diff --git a/src/test/java/software/amazon/encryption/s3/internal/ConvertSDKRequestsTest.java b/src/test/java/software/amazon/encryption/s3/internal/ConvertSDKRequestsTest.java
index fc167d502..c89a3e8ef 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/ConvertSDKRequestsTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/ConvertSDKRequestsTest.java
@@ -1,6 +1,6 @@
package software.amazon.encryption.s3.internal;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.services.s3.model.*;
@@ -13,7 +13,7 @@
class ConvertSDKRequestsTest {
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_Bucket() {
final String value = "test-bucket";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -24,7 +24,7 @@ void testConvertPutObjectRequest_Bucket() {
assertEquals(value, convertedRequest.bucket());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ACL() {
final ObjectCannedACL value = ObjectCannedACL.PRIVATE;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -35,7 +35,7 @@ void testConvertPutObjectRequest_ACL() {
assertEquals(value, convertedRequest.acl());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ACL2() {
final String value = ObjectCannedACL.PRIVATE.toString();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -46,7 +46,7 @@ void testConvertPutObjectRequest_ACL2() {
assertEquals(value, convertedRequest.acl().toString());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_BucketKeyEnabled() {
final Boolean value = true;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -57,7 +57,7 @@ void testConvertPutObjectRequest_BucketKeyEnabled() {
assertEquals(value, convertedRequest.bucketKeyEnabled());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_CacheControl() {
final String value = "max-age=3600";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -68,7 +68,7 @@ void testConvertPutObjectRequest_CacheControl() {
assertEquals(value, convertedRequest.cacheControl());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ChecksumAlgorithm() {
final ChecksumAlgorithm value = ChecksumAlgorithm.SHA256;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -79,7 +79,7 @@ void testConvertPutObjectRequest_ChecksumAlgorithm() {
assertEquals(value, convertedRequest.checksumAlgorithm());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ChecksumAlgorithm2() {
final String value = ChecksumAlgorithm.SHA256.toString();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -90,7 +90,7 @@ void testConvertPutObjectRequest_ChecksumAlgorithm2() {
assertEquals(value, convertedRequest.checksumAlgorithm().toString());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ContentDisposition() {
final String value = "attachment; filename=\"filename.jpg\"";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -101,7 +101,7 @@ void testConvertPutObjectRequest_ContentDisposition() {
assertEquals(value, convertedRequest.contentDisposition());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ContentEncoding() {
final String value = "gzip";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -112,7 +112,7 @@ void testConvertPutObjectRequest_ContentEncoding() {
assertEquals(value, convertedRequest.contentEncoding());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ContentLanguage() {
final String value = "en-US";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -123,7 +123,7 @@ void testConvertPutObjectRequest_ContentLanguage() {
assertEquals(value, convertedRequest.contentLanguage());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ContentType() {
final String value = "text/plain";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -134,7 +134,7 @@ void testConvertPutObjectRequest_ContentType() {
assertEquals(value, convertedRequest.contentType());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ExpectedBucketOwner() {
final String value = "owner123";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -145,7 +145,7 @@ void testConvertPutObjectRequest_ExpectedBucketOwner() {
assertEquals(value, convertedRequest.expectedBucketOwner());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_Expires() {
final Instant value = Instant.now();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -156,7 +156,7 @@ void testConvertPutObjectRequest_Expires() {
assertEquals(value, convertedRequest.expires());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_GrantFullControl() {
final String value = "id=123";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -167,7 +167,7 @@ void testConvertPutObjectRequest_GrantFullControl() {
assertEquals(value, convertedRequest.grantFullControl());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_GrantRead() {
final String value = "id=123";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -178,7 +178,7 @@ void testConvertPutObjectRequest_GrantRead() {
assertEquals(value, convertedRequest.grantRead());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_GrantReadACP() {
final String value = "id=123";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -189,7 +189,7 @@ void testConvertPutObjectRequest_GrantReadACP() {
assertEquals(value, convertedRequest.grantReadACP());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_GrantWriteACP() {
final String value = "id=123";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -200,7 +200,7 @@ void testConvertPutObjectRequest_GrantWriteACP() {
assertEquals(value, convertedRequest.grantWriteACP());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_Key() {
final String value = "test-key";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -211,7 +211,7 @@ void testConvertPutObjectRequest_Key() {
assertEquals(value, convertedRequest.key());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_Metadata() {
final Map value = new HashMap<>();
value.put("key1", "value1");
@@ -223,7 +223,7 @@ void testConvertPutObjectRequest_Metadata() {
assertEquals(value, convertedRequest.metadata());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ObjectLockLegalHoldStatus() {
final ObjectLockLegalHoldStatus value = ObjectLockLegalHoldStatus.ON;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -234,7 +234,7 @@ void testConvertPutObjectRequest_ObjectLockLegalHoldStatus() {
assertEquals(value, convertedRequest.objectLockLegalHoldStatus());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ObjectLockLegalHoldStatus2() {
final String value = ObjectLockLegalHoldStatus.ON.toString();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -245,7 +245,7 @@ void testConvertPutObjectRequest_ObjectLockLegalHoldStatus2() {
assertEquals(value, convertedRequest.objectLockLegalHoldStatus().toString());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ObjectLockMode() {
final ObjectLockMode value = ObjectLockMode.GOVERNANCE;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -256,7 +256,7 @@ void testConvertPutObjectRequest_ObjectLockMode() {
assertEquals(value, convertedRequest.objectLockMode());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ObjectLockMode2() {
final String value = "GOVERNANCE";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -267,7 +267,7 @@ void testConvertPutObjectRequest_ObjectLockMode2() {
assertEquals(value, convertedRequest.objectLockMode().toString());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ObjectLockRetainUntilDate() {
final Instant value = Instant.now();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -278,7 +278,7 @@ void testConvertPutObjectRequest_ObjectLockRetainUntilDate() {
assertEquals(value, convertedRequest.objectLockRetainUntilDate());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_RequestPayer() {
final RequestPayer value = RequestPayer.REQUESTER;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -289,7 +289,7 @@ void testConvertPutObjectRequest_RequestPayer() {
assertEquals(value, convertedRequest.requestPayer());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_RequestPayer2() {
final String value = RequestPayer.REQUESTER.toString();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -300,7 +300,7 @@ void testConvertPutObjectRequest_RequestPayer2() {
assertEquals(value, convertedRequest.requestPayer().toString());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ServerSideEncryption() {
final ServerSideEncryption value = ServerSideEncryption.AES256;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -311,7 +311,7 @@ void testConvertPutObjectRequest_ServerSideEncryption() {
assertEquals(value, convertedRequest.serverSideEncryption());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_ServerSideEncryption2() {
final String value = ServerSideEncryption.AES256.toString();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -322,7 +322,7 @@ void testConvertPutObjectRequest_ServerSideEncryption2() {
assertEquals(value, convertedRequest.serverSideEncryption().toString());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_SSECustomerAlgorithm() {
final String value = "AES256";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -333,7 +333,7 @@ void testConvertPutObjectRequest_SSECustomerAlgorithm() {
assertEquals(value, convertedRequest.sseCustomerAlgorithm());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_SSECustomerKey() {
final String value = "key123";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -344,7 +344,7 @@ void testConvertPutObjectRequest_SSECustomerKey() {
assertEquals(value, convertedRequest.sseCustomerKey());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_SSEKMSKeyId() {
final String value = "arn:aws:kms:region:123456789012:key/key-id";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -355,7 +355,7 @@ void testConvertPutObjectRequest_SSEKMSKeyId() {
assertEquals(value, convertedRequest.ssekmsKeyId());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_SSEKMSEncryptionContext() {
final String value = "context123";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -366,7 +366,7 @@ void testConvertPutObjectRequest_SSEKMSEncryptionContext() {
assertEquals(value, convertedRequest.ssekmsEncryptionContext());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_StorageClass() {
final StorageClass value = StorageClass.STANDARD;
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -377,7 +377,7 @@ void testConvertPutObjectRequest_StorageClass() {
assertEquals(value, convertedRequest.storageClass());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_StorageClass2() {
final String value = StorageClass.STANDARD.toString();
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -388,7 +388,7 @@ void testConvertPutObjectRequest_StorageClass2() {
assertEquals(value, convertedRequest.storageClass().toString());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_Tagging() {
final String value = "key1=value1&key2=value2";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -399,7 +399,7 @@ void testConvertPutObjectRequest_Tagging() {
assertEquals(value, convertedRequest.tagging());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_WebsiteRedirectLocation() {
final String value = "/redirected";
PutObjectRequest originalRequest = PutObjectRequest.builder()
@@ -410,7 +410,7 @@ void testConvertPutObjectRequest_WebsiteRedirectLocation() {
assertEquals(value, convertedRequest.websiteRedirectLocation());
}
- @Test
+ @RetryingTest(3)
void testConvertPutObjectRequest_OverrideConfiguration() {
final AwsRequestOverrideConfiguration value = AwsRequestOverrideConfiguration
.builder()
@@ -425,7 +425,7 @@ void testConvertPutObjectRequest_OverrideConfiguration() {
assertEquals(value, convertedRequest.overrideConfiguration().get());
}
- @Test
+ @RetryingTest(3)
public void testConvertResponse() {
// Create a CompleteMultipartUploadResponse with various fields set
CompleteMultipartUploadResponse completeResponse = CompleteMultipartUploadResponse.builder()
@@ -473,7 +473,7 @@ public void testConvertResponse() {
assertNull(putResponse.size());
}
- @Test
+ @RetryingTest(3)
public void testBasicConvertMultipartUploadRequest() {
// Create a MultipartUploadRequest with various fields set
CreateMultipartUploadRequest request = CreateMultipartUploadRequest.builder()
@@ -486,7 +486,7 @@ public void testBasicConvertMultipartUploadRequest() {
assertNotNull(result);
}
- @Test
+ @RetryingTest(3)
public void testConversionAllFieldsMultipartUploadRequestToPutObjectRequest() {
Map metadata = new HashMap();
metadata.put("test-key-1", "test-value-1");
@@ -559,7 +559,7 @@ public void testConversionAllFieldsMultipartUploadRequestToPutObjectRequest() {
assertEquals("test-website-redirect-location", result.websiteRedirectLocation());
}
- @Test
+ @RetryingTest(3)
public void testConvertMultipartUploadRequestWithNullValues() {
CreateMultipartUploadRequest request = CreateMultipartUploadRequest.builder()
.bucket("test-bucket")
diff --git a/src/test/java/software/amazon/encryption/s3/internal/EncryptedContentTest.java b/src/test/java/software/amazon/encryption/s3/internal/EncryptedContentTest.java
index 4d0aea363..177ca47a1 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/EncryptedContentTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/EncryptedContentTest.java
@@ -7,13 +7,13 @@
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertNull;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.async.AsyncRequestBody;
public class EncryptedContentTest {
- @Test
+ @RetryingTest(3)
public void testIvAndMessageIdCanBeRetrievedForContentMetadata() {
// Test data
byte[] testIv = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
@@ -39,7 +39,7 @@ public void testIvAndMessageIdCanBeRetrievedForContentMetadata() {
assertNotSame(testMessageId, retrievedMessageId, "Message ID should be a defensive copy");
}
- @Test
+ @RetryingTest(3)
public void testNullIvAndMessageIdHandling() {
AsyncRequestBody mockRequestBody = AsyncRequestBody.fromString("test content");
long ciphertextLength = 100L;
diff --git a/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigUploadTest.java b/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigUploadTest.java
index 41cc5f287..826d58c85 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigUploadTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigUploadTest.java
@@ -1,6 +1,6 @@
package software.amazon.encryption.s3.internal;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import org.mockito.ArgumentCaptor;
import software.amazon.awssdk.core.async.AsyncRequestBody;
import software.amazon.awssdk.core.sync.RequestBody;
@@ -16,7 +16,7 @@
class InstructionFileConfigUploadTest {
- @Test
+ @RetryingTest(3)
void uploadInstructionFileWithSetContentLengthSyncClient() {
// Create a mock for the S3 client
S3Client mockedS3Client = mock(S3Client.class);
@@ -42,7 +42,7 @@ void uploadInstructionFileWithSetContentLengthSyncClient() {
assertEquals(instructionFileContent.getBytes().length, instructionFilePutCaptor.getValue().contentLength());
}
- @Test
+ @RetryingTest(3)
void uploadInstructionFileWithSetContentLengthAsyncClient() {
// Create a mock for the S3 client
S3AsyncClient mockedS3Client = mock(S3AsyncClient.class);
diff --git a/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigValidationTest.java b/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigValidationTest.java
index cb5e8fd16..0a005f50f 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigValidationTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/InstructionFileConfigValidationTest.java
@@ -6,7 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.services.s3.S3AsyncClient;
import software.amazon.awssdk.services.s3.S3Client;
@@ -14,7 +14,7 @@
public class InstructionFileConfigValidationTest {
- @Test
+ @RetryingTest(3)
public void testBuilderWithBothClientsSet() {
S3Client syncClient = S3Client.create();
S3AsyncClient asyncClient = S3AsyncClient.create();
@@ -30,14 +30,14 @@ public void testBuilderWithBothClientsSet() {
asyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithNoClientAndNotDisabled() {
assertThrows(S3EncryptionClientException.class, () ->
InstructionFileConfig.builder().build()
);
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithClientAndDisabled() {
S3Client syncClient = S3Client.create();
@@ -51,7 +51,7 @@ public void testBuilderWithClientAndDisabled() {
syncClient.close();
}
- @Test
+ @RetryingTest(3)
public void testBuilderWithPutEnabledButDisabled() {
assertThrows(S3EncryptionClientException.class, () ->
InstructionFileConfig.builder()
@@ -61,7 +61,7 @@ public void testBuilderWithPutEnabledButDisabled() {
);
}
- @Test
+ @RetryingTest(3)
public void testValidConfigurations() {
S3Client syncClient = S3Client.create();
S3AsyncClient asyncClient = S3AsyncClient.create();
@@ -90,7 +90,7 @@ public void testValidConfigurations() {
asyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void testDefaultInstructionFilePutDisabled() {
S3Client syncClient = S3Client.create();
@@ -103,7 +103,7 @@ public void testDefaultInstructionFilePutDisabled() {
syncClient.close();
}
- @Test
+ @RetryingTest(3)
public void testInstructionFileConfigWithAsyncClient() {
S3AsyncClient asyncClient = S3AsyncClient.create();
@@ -116,7 +116,7 @@ public void testInstructionFileConfigWithAsyncClient() {
asyncClient.close();
}
- @Test
+ @RetryingTest(3)
public void testInstructionFileConfigDisabledState() {
InstructionFileConfig disabledConfig = InstructionFileConfig.builder()
.disableInstructionFile(true)
diff --git a/src/test/java/software/amazon/encryption/s3/internal/MetadataKeyConstantsTest.java b/src/test/java/software/amazon/encryption/s3/internal/MetadataKeyConstantsTest.java
index fbc236472..352d80c6f 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/MetadataKeyConstantsTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/MetadataKeyConstantsTest.java
@@ -5,13 +5,13 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.S3EncryptionClientException;
public class MetadataKeyConstantsTest {
- @Test
+ @RetryingTest(3)
public void testWrappingAlgorithmCompression() {
//= specification/s3-encryption/data-format/content-metadata.md#v3-only
//= type=test
@@ -37,7 +37,7 @@ public void testWrappingAlgorithmCompression() {
});
}
- @Test
+ @RetryingTest(3)
public void testWrappingAlgorithmDecompression() {
//= specification/s3-encryption/data-format/content-metadata.md#v3-only
//= type=test
diff --git a/src/test/java/software/amazon/encryption/s3/internal/StreamingAesGcmContentStrategyTest.java b/src/test/java/software/amazon/encryption/s3/internal/StreamingAesGcmContentStrategyTest.java
index ba9f7c020..a45d3764d 100644
--- a/src/test/java/software/amazon/encryption/s3/internal/StreamingAesGcmContentStrategyTest.java
+++ b/src/test/java/software/amazon/encryption/s3/internal/StreamingAesGcmContentStrategyTest.java
@@ -13,7 +13,7 @@
import javax.crypto.SecretKey;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.async.AsyncRequestBody;
import software.amazon.encryption.s3.S3EncryptionClientException;
@@ -34,13 +34,13 @@ public static void setUp() throws Exception {
AES_KEY = keyGen.generateKey();
}
- @Test
+ @RetryingTest(3)
public void buildStreamingAesGcmContentStrategyWithNullSecureRandomFails() {
S3EncryptionClientException exception = assertThrows(S3EncryptionClientException.class, () -> StreamingAesGcmContentStrategy.builder().secureRandom(null));
assertTrue(exception.getMessage().contains("SecureRandom provided to StreamingAesGcmContentStrategy cannot be null"));
}
- @Test
+ @RetryingTest(3)
public void testEncryptContentValidatesMaxContentLength() {
StreamingAesGcmContentStrategy strategy = StreamingAesGcmContentStrategy.builder().build();
@@ -62,7 +62,7 @@ public void testEncryptContentValidatesMaxContentLength() {
assertTrue(exception.getMessage().contains("maximum length allowed for GCM encryption"));
}
- @Test
+ @RetryingTest(3)
public void testInitMultipartEncryptionValidatesMaxContentLength() {
StreamingAesGcmContentStrategy strategy = StreamingAesGcmContentStrategy.builder().build();
@@ -85,7 +85,7 @@ public void testInitMultipartEncryptionValidatesMaxContentLength() {
//= specification/s3-encryption/encryption.md#content-encryption
//= type=test
//# The generated IV or Message ID MUST be set or returned from the encryption process such that it can be included in the content metadata.
- @Test
+ @RetryingTest(3)
public void testEncryptContentWithNonCommitingAlgorithm() {
StreamingAesGcmContentStrategy strategy = StreamingAesGcmContentStrategy.builder().build();
@@ -111,7 +111,7 @@ public void testEncryptContentWithNonCommitingAlgorithm() {
assertEquals(AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF.commitmentNonceLengthBytes(), encryptContent.messageId().length);
}
- @Test
+ @RetryingTest(3)
public void testEncryptContentWithCommittingAlgorithm() {
StreamingAesGcmContentStrategy strategy = StreamingAesGcmContentStrategy.builder().build();
diff --git a/src/test/java/software/amazon/encryption/s3/legacy/internal/RangedGetUtilsTest.java b/src/test/java/software/amazon/encryption/s3/legacy/internal/RangedGetUtilsTest.java
index 93a675f5b..71c1e1f70 100644
--- a/src/test/java/software/amazon/encryption/s3/legacy/internal/RangedGetUtilsTest.java
+++ b/src/test/java/software/amazon/encryption/s3/legacy/internal/RangedGetUtilsTest.java
@@ -4,10 +4,10 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
public class RangedGetUtilsTest {
- @Test
+ @RetryingTest(3)
public void testGetRangeWithValidRanges() {
// Valid single and complete ranges
assertArrayEquals(new long[]{10, Long.MAX_VALUE}, RangedGetUtils.getRange("bytes=10-"), "Start range should return expected output");
@@ -19,7 +19,7 @@ public void testGetRangeWithValidRanges() {
assertArrayEquals(new long[]{Long.MAX_VALUE - 1, Long.MAX_VALUE}, RangedGetUtils.getRange("bytes=" + (Long.MAX_VALUE - 1) + "-" + Long.MAX_VALUE));
}
- @Test
+ @RetryingTest(3)
public void testGetRangeWithInvalidInputs() {
// Null, empty, and invalid format inputs
assertNull(RangedGetUtils.getRange(null), "Range should be null for null input");
@@ -30,7 +30,7 @@ public void testGetRangeWithInvalidInputs() {
assertNull(RangedGetUtils.getRange("bytes=-10"), "Range should be null for invalid range with only end specified");
}
- @Test
+ @RetryingTest(3)
public void testGetCryptoRangeWithInvalidRanges() {
assertNull(RangedGetUtils.getCryptoRangeAsString("bytes=-100"), "Should return null for not specifying start range");
assertNull(RangedGetUtils.getCryptoRangeAsString("bytes=100-10"), "Should return null for start greater than end range");
@@ -39,7 +39,7 @@ public void testGetCryptoRangeWithInvalidRanges() {
//= specification/s3-encryption/decryption.md#ranged-gets
//= type=test
//# If the S3EC supports Ranged Gets, the S3EC MUST adjust the customer-provided range to include the beginning and end of the cipher blocks for the given range.
- @Test
+ @RetryingTest(3)
public void testGetCryptoRangeAsStringAndAdjustmentWithValidRanges() {
// Adjusted to include the full block that contains byte 0 and the full block after byte 15, given block size of 16
assertEquals("bytes=0-32", RangedGetUtils.getCryptoRangeAsString("bytes=0-15"), "Should correctly adjust to full blocks for range as string");
diff --git a/src/test/java/software/amazon/encryption/s3/materials/AesKeyringTest.java b/src/test/java/software/amazon/encryption/s3/materials/AesKeyringTest.java
index a71d3a5b2..53f507641 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/AesKeyringTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/AesKeyringTest.java
@@ -2,24 +2,24 @@
// SPDX-License-Identifier: Apache-2.0
package software.amazon.encryption.s3.materials;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.S3EncryptionClientException;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class AesKeyringTest {
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithNullWrappingKeyFails() {
assertThrows(S3EncryptionClientException.class, () -> AesKeyring.builder().wrappingKey(null));
}
- @Test
+ @RetryingTest(3)
public void buildAesKeyringWithNullSecureRandomFails() {
assertThrows(S3EncryptionClientException.class, () -> AesKeyring.builder().secureRandom(null));
}
- @Test
+ @RetryingTest(3)
public void buildAesKeyringWithNullDataKeyGeneratorFails() {
assertThrows(S3EncryptionClientException.class, () -> AesKeyring.builder().dataKeyGenerator(null));
}
diff --git a/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsManagerTest.java b/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsManagerTest.java
index b1981e74d..c8633e4d4 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsManagerTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsManagerTest.java
@@ -10,7 +10,7 @@
import static software.amazon.encryption.s3.utils.S3EncryptionClientTestResources.appendTestSuffix;
import static software.amazon.encryption.s3.utils.S3EncryptionClientTestResources.deleteObject;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.services.s3.S3Client;
@@ -21,7 +21,7 @@
public class CryptographicMaterialsManagerTest {
- @Test
+ @RetryingTest(3)
public void testCMMReturningNullEncryptionMaterialsThrowsException() {
final String objectKey = appendTestSuffix("test-cmm-null-encryption-materials");
@@ -50,7 +50,7 @@ public void testCMMReturningNullEncryptionMaterialsThrowsException() {
encryptionClient.close();
}
- @Test
+ @RetryingTest(3)
public void testCMMReturningNullDecryptionMaterialsThrowsException() {
final String objectKey = appendTestSuffix("test-cmm-null-decryption-materials");
diff --git a/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsValidationTest.java b/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsValidationTest.java
index d82e89c1a..c856d0738 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsValidationTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/CryptographicMaterialsValidationTest.java
@@ -7,14 +7,14 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
import software.amazon.encryption.s3.algorithms.AlgorithmSuite;
public class CryptographicMaterialsValidationTest {
- @Test
+ @RetryingTest(3)
public void testEncryptionMaterialsWithNullAlgorithmSuite() {
assertThrows(NullPointerException.class, () ->
EncryptionMaterials.builder()
@@ -25,7 +25,7 @@ public void testEncryptionMaterialsWithNullAlgorithmSuite() {
);
}
- @Test
+ @RetryingTest(3)
public void testEncryptionMaterialsWithInvalidDataKeyLength() {
// Test with wrong data key length - this might be validated by the keyring rather than materials
byte[] shortKey = new byte[16]; // Should be 32 for AES-256
@@ -42,7 +42,7 @@ public void testEncryptionMaterialsWithInvalidDataKeyLength() {
assertEquals(16, materials.plaintextDataKey().length);
}
- @Test
+ @RetryingTest(3)
public void testMaterialsDescriptionValidation() {
// Test empty materials description
MaterialsDescription emptyDesc = MaterialsDescription.builder().build();
@@ -59,7 +59,7 @@ public void testMaterialsDescriptionValidation() {
);
}
- @Test
+ @RetryingTest(3)
public void testEncryptedDataKeyValidation() {
// Test with null encrypted key
EncryptedDataKey keyWithNullData = EncryptedDataKey.builder()
@@ -89,7 +89,7 @@ public void testEncryptedDataKeyValidation() {
assertNull(keyWithNullProvider.keyProviderId());
}
- @Test
+ @RetryingTest(3)
public void testEncryptedDataKeyWithEmptyEncryptedKey() {
// Test with empty encrypted key array
EncryptedDataKey keyWithEmptyData = EncryptedDataKey.builder()
@@ -101,7 +101,7 @@ public void testEncryptedDataKeyWithEmptyEncryptedKey() {
assertEquals(0, keyWithEmptyData.encryptedDatakey().length);
}
- @Test
+ @RetryingTest(3)
public void testValidEncryptedDataKeyCreation() {
// Test valid encrypted data key creation
EncryptedDataKey validKey = EncryptedDataKey.builder()
@@ -115,7 +115,7 @@ public void testValidEncryptedDataKeyCreation() {
assertEquals("test-info", validKey.keyProviderInfo());
}
- @Test
+ @RetryingTest(3)
public void testValidMaterialsDescriptionCreation() {
// Test valid materials description with multiple entries
MaterialsDescription desc = MaterialsDescription.builder()
diff --git a/src/test/java/software/amazon/encryption/s3/materials/DecryptionMaterialsTest.java b/src/test/java/software/amazon/encryption/s3/materials/DecryptionMaterialsTest.java
index a8ca0853e..58a92adb5 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/DecryptionMaterialsTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/DecryptionMaterialsTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.materials;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
import software.amazon.encryption.s3.algorithms.AlgorithmSuite;
@@ -31,18 +31,18 @@ public void setUp() {
.build();
}
- @Test
+ @RetryingTest(3)
public void testS3Request() {
assertEquals(s3Request, actualDecryptionMaterials.s3Request());
}
- @Test
+ @RetryingTest(3)
public void testAlgorithmSuite() {
assertEquals(AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF, actualDecryptionMaterials.algorithmSuite());
assertNotEquals(AlgorithmSuite.ALG_AES_256_CBC_IV16_NO_KDF, actualDecryptionMaterials.algorithmSuite());
}
- @Test
+ @RetryingTest(3)
public void testEncryptionContext() {
assertEquals(encryptionContext, actualDecryptionMaterials.encryptionContext());
}
diff --git a/src/test/java/software/amazon/encryption/s3/materials/DefaultDataKeyGeneratorTest.java b/src/test/java/software/amazon/encryption/s3/materials/DefaultDataKeyGeneratorTest.java
index fd8e0c6e7..d9d7c454e 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/DefaultDataKeyGeneratorTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/DefaultDataKeyGeneratorTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.materials;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.algorithms.AlgorithmSuite;
import javax.crypto.SecretKey;
@@ -14,7 +14,7 @@ public class DefaultDataKeyGeneratorTest {
private final DataKeyGenerator dataKeyGenerator = new DefaultDataKeyGenerator();
- @Test
+ @RetryingTest(3)
public void testGenerateDataKey() {
SecretKey actualSecretKey = dataKeyGenerator.generateDataKey(AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF, null);
assertEquals("AES", actualSecretKey.getAlgorithm());
diff --git a/src/test/java/software/amazon/encryption/s3/materials/EncryptedDataKeyTest.java b/src/test/java/software/amazon/encryption/s3/materials/EncryptedDataKeyTest.java
index 12403bd5f..37a42960e 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/EncryptedDataKeyTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/EncryptedDataKeyTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.materials;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import java.util.Arrays;
@@ -29,17 +29,17 @@ public void setUp() {
.build();
}
- @Test
+ @RetryingTest(3)
public void keyProviderId() {
assertEquals(keyProviderId, actualEncryptedDataKey.keyProviderId());
}
- @Test
+ @RetryingTest(3)
public void keyProviderInfo() {
assertEquals(keyProviderInfo, actualEncryptedDataKey.keyProviderInfo());
}
- @Test
+ @RetryingTest(3)
public void ciphertext() {
assertEquals(Arrays.toString(encryptedDataKey), Arrays.toString(actualEncryptedDataKey.encryptedDatakey()));
}
diff --git a/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsRequestTest.java b/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsRequestTest.java
index d0ed30eef..4d3beefa3 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsRequestTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsRequestTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.materials;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
import java.util.HashMap;
@@ -26,12 +26,12 @@ public void setUp() {
.s3Request(request).encryptionContext(encryptionContext).build();
}
- @Test
+ @RetryingTest(3)
public void testS3Request() {
assertEquals(request, actualRequestBuilder.s3Request());
}
- @Test
+ @RetryingTest(3)
public void testEncryptionContext() {
assertEquals(encryptionContext, actualRequestBuilder.encryptionContext());
}
diff --git a/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsTest.java b/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsTest.java
index f6808e244..58fbf762e 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/EncryptionMaterialsTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.materials;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
import software.amazon.encryption.s3.algorithms.AlgorithmSuite;
import software.amazon.encryption.s3.internal.CipherMode;
@@ -40,38 +40,38 @@ public void setUp() {
.plaintextDataKey(plaintextDataKey)
.build();
}
- @Test
+ @RetryingTest(3)
void testS3Request() {
assertEquals(s3Request, actualEncryptionMaterials.s3Request());
}
- @Test
+ @RetryingTest(3)
void testAlgorithmSuite() {
assertEquals(AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF, actualEncryptionMaterials.algorithmSuite());
assertNotEquals(AlgorithmSuite.ALG_AES_256_CBC_IV16_NO_KDF, actualEncryptionMaterials.algorithmSuite());
}
- @Test
+ @RetryingTest(3)
void testEncryptionContext() {
assertEquals(encryptionContext, actualEncryptionMaterials.encryptionContext());
}
- @Test
+ @RetryingTest(3)
void testEncryptedDataKeys() {
assertEquals(encryptedDataKeys, actualEncryptionMaterials.encryptedDataKeys());
}
- @Test
+ @RetryingTest(3)
void testPlaintextDataKey() {
assertEquals(Arrays.toString(plaintextDataKey), Arrays.toString(actualEncryptionMaterials.plaintextDataKey()));
}
- @Test
+ @RetryingTest(3)
void testCipherMode() {
assertEquals(CipherMode.ENCRYPT, actualEncryptionMaterials.cipherMode());
}
- @Test
+ @RetryingTest(3)
void testSetIvAndMessageId() {
SecureRandom secureRandom = new SecureRandom();
byte[] iv = new byte[12];
@@ -87,7 +87,7 @@ void testSetIvAndMessageId() {
assertTrue(MessageDigest.isEqual(messageId, actualEncryptionMaterials.messageId()));
}
- @Test
+ @RetryingTest(3)
void testToBuilder() {
EncryptionMaterials actualToBuilder = actualEncryptionMaterials.toBuilder().build();
assertEquals(s3Request, actualToBuilder.s3Request());
diff --git a/src/test/java/software/amazon/encryption/s3/materials/KeyMaterialTest.java b/src/test/java/software/amazon/encryption/s3/materials/KeyMaterialTest.java
index d4de47d05..c77090041 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/KeyMaterialTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/KeyMaterialTest.java
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package software.amazon.encryption.s3.materials;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
@@ -23,7 +23,7 @@ public class KeyMaterialTest {
/**
* Test creating AesKeyMaterial using the builder.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyMaterial() throws NoSuchAlgorithmException {
// Generate an AES key
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
@@ -50,7 +50,7 @@ public void testAesKeyMaterial() throws NoSuchAlgorithmException {
/**
* Test creating RsaKeyMaterial using the builder.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyMaterial() throws NoSuchAlgorithmException {
// Generate an RSA key pair
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
@@ -83,7 +83,7 @@ public void testRsaKeyMaterial() throws NoSuchAlgorithmException {
/**
* Test using AesKeyMaterial with additionalDecryptionKeyMaterial.
*/
- @Test
+ @RetryingTest(3)
public void testAesKeyMaterialWithAdditionalDecryptionKeyMaterial() throws NoSuchAlgorithmException {
// Generate AES keys
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
@@ -126,7 +126,7 @@ public void testAesKeyMaterialWithAdditionalDecryptionKeyMaterial() throws NoSuc
/**
* Test using RsaKeyMaterial with additionalDecryptionKeyMaterial.
*/
- @Test
+ @RetryingTest(3)
public void testRsaKeyMaterialWithAdditionalDecryptionKeyMaterial() throws NoSuchAlgorithmException {
// Generate RSA key pairs
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
diff --git a/src/test/java/software/amazon/encryption/s3/materials/KeyringValidationTest.java b/src/test/java/software/amazon/encryption/s3/materials/KeyringValidationTest.java
index bc46b0d38..d34798d7e 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/KeyringValidationTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/KeyringValidationTest.java
@@ -13,7 +13,7 @@
import javax.crypto.SecretKey;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.S3EncryptionClientException;
@@ -33,7 +33,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithInvalidKeySize() throws NoSuchAlgorithmException {
// Test with 128-bit key (should work)
KeyGenerator keyGen128 = KeyGenerator.getInstance("AES");
@@ -54,7 +54,7 @@ public void testAesKeyringWithInvalidKeySize() throws NoSuchAlgorithmException {
);
}
- @Test
+ @RetryingTest(3)
public void testPartialRsaKeyPairValidation() {
// Test with null private and public key
assertThrows(S3EncryptionClientException.class, () ->
@@ -72,7 +72,7 @@ public void testPartialRsaKeyPairValidation() {
);
}
- @Test
+ @RetryingTest(3)
public void testKmsKeyringWithInvalidKeyId() {
// Test with empty key ID
assertThrows(S3EncryptionClientException.class, () ->
@@ -85,7 +85,7 @@ public void testKmsKeyringWithInvalidKeyId() {
);
}
- @Test
+ @RetryingTest(3)
public void testMaterialsDescriptionEdgeCases() {
// Test with very long key/value pairs
StringBuilder longKeyBuilder = new StringBuilder();
@@ -109,14 +109,14 @@ public void testMaterialsDescriptionEdgeCases() {
);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithNullWrappingKey() {
assertThrows(S3EncryptionClientException.class, () ->
AesKeyring.builder().wrappingKey(null).build()
);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithNullSecureRandom() {
assertThrows(S3EncryptionClientException.class, () ->
AesKeyring.builder()
@@ -126,7 +126,7 @@ public void testAesKeyringWithNullSecureRandom() {
);
}
- @Test
+ @RetryingTest(3)
public void testAesKeyringWithNullDataKeyGenerator() {
assertThrows(S3EncryptionClientException.class, () ->
AesKeyring.builder()
@@ -136,14 +136,14 @@ public void testAesKeyringWithNullDataKeyGenerator() {
);
}
- @Test
+ @RetryingTest(3)
public void testRsaKeyringWithNullKeyPair() {
assertThrows(S3EncryptionClientException.class, () ->
RsaKeyring.builder().wrappingKeyPair(null).build()
);
}
- @Test
+ @RetryingTest(3)
public void testValidKeyringCreation() {
// Test valid AES keyring creation
assertDoesNotThrow(() -> {
diff --git a/src/test/java/software/amazon/encryption/s3/materials/KmsDiscoveryKeyringTest.java b/src/test/java/software/amazon/encryption/s3/materials/KmsDiscoveryKeyringTest.java
index 5856d4827..3d6362f7e 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/KmsDiscoveryKeyringTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/KmsDiscoveryKeyringTest.java
@@ -11,7 +11,7 @@
import com.amazonaws.services.s3.model.EncryptedPutObjectRequest;
import com.amazonaws.services.s3.model.EncryptionMaterialsProvider;
import com.amazonaws.services.s3.model.KMSEncryptionMaterialsProvider;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.services.s3.S3Client;
@@ -38,17 +38,17 @@ public class KmsDiscoveryKeyringTest {
private static final String KMS_KEY_ID = System.getenv("AWS_S3EC_TEST_KMS_KEY_ID");
private static final Region KMS_REGION = Region.getRegion(Regions.fromName(System.getenv("AWS_REGION")));
- @Test
+ @RetryingTest(3)
public void buildKmsDiscoveryKeyringWithNullSecureRandomFails() {
assertThrows(S3EncryptionClientException.class, () -> KmsDiscoveryKeyring.builder().secureRandom(null));
}
- @Test
+ @RetryingTest(3)
public void buildDiscoveryKeyringWithNullDataKeyGeneratorFails() {
assertThrows(S3EncryptionClientException.class, () -> KmsDiscoveryKeyring.builder().dataKeyGenerator(null));
}
- @Test
+ @RetryingTest(3)
public void testKmsDiscovery() {
final String objectKey = appendTestSuffix("kms-v1-to-v3-discovery");
@@ -87,7 +87,7 @@ public void testKmsDiscovery() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testKmsContextV2Discovery() {
final String objectKey = appendTestSuffix("kms-context-v2-to-v3-discovery");
@@ -130,7 +130,7 @@ public void testKmsContextV2Discovery() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testKmsContextV3Discovery() {
final String objectKey = appendTestSuffix("kms-v3-to-v3-discovery-context");
@@ -167,7 +167,7 @@ public void testKmsContextV3Discovery() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testKmsContextV3DiscoveryWrongECFails() {
final String objectKey = appendTestSuffix("kms-v3-to-v3-discovery-context-wrong-ec");
@@ -210,7 +210,7 @@ public void testKmsContextV3DiscoveryWrongECFails() {
s3Client.close();
}
- @Test
+ @RetryingTest(3)
public void testKmsContextV3DiscoveryEncryptFails() {
final String objectKey = appendTestSuffix("kms-v3-to-v3-discovery-context-encrypt-fails");
diff --git a/src/test/java/software/amazon/encryption/s3/materials/KmsKeyringTest.java b/src/test/java/software/amazon/encryption/s3/materials/KmsKeyringTest.java
index b9cca6815..3a99210dc 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/KmsKeyringTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/KmsKeyringTest.java
@@ -2,19 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
package software.amazon.encryption.s3.materials;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.S3EncryptionClientException;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class KmsKeyringTest {
- @Test
+ @RetryingTest(3)
public void buildKmsKeyringWithNullSecureRandomFails() {
assertThrows(S3EncryptionClientException.class, () -> KmsKeyring.builder().secureRandom(null));
}
- @Test
+ @RetryingTest(3)
public void buildKmsKeyringWithNullDataKeyGeneratorFails() {
assertThrows(S3EncryptionClientException.class, () -> KmsKeyring.builder().dataKeyGenerator(null));
}
diff --git a/src/test/java/software/amazon/encryption/s3/materials/MaterialsDescriptionTest.java b/src/test/java/software/amazon/encryption/s3/materials/MaterialsDescriptionTest.java
index 2865c054b..b40fda7a4 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/MaterialsDescriptionTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/MaterialsDescriptionTest.java
@@ -1,7 +1,7 @@
package software.amazon.encryption.s3.materials;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
@@ -34,7 +34,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void testSimpleMaterialsDescription() {
MaterialsDescription materialsDescription = MaterialsDescription
.builder()
@@ -59,7 +59,7 @@ public void testSimpleMaterialsDescription() {
}
}
- @Test
+ @RetryingTest(3)
public void testMaterialsDescriptionPutAll() {
Map description = new HashMap<>();
description.put("version", "1.0");
@@ -85,7 +85,7 @@ public void testMaterialsDescriptionPutAll() {
);
}
- @Test
+ @RetryingTest(3)
public void testMaterialsDescriptionAesKeyring() {
AesKeyring aesKeyring = AesKeyring
.builder()
@@ -101,7 +101,7 @@ public void testMaterialsDescriptionAesKeyring() {
assertNotNull(aesKeyring);
}
- @Test
+ @RetryingTest(3)
public void testMaterialsDescriptionRsaKeyring() {
PartialRsaKeyPair keyPair = new PartialRsaKeyPair(
RSA_KEY_PAIR.getPrivate(),
@@ -121,7 +121,7 @@ public void testMaterialsDescriptionRsaKeyring() {
assertNotNull(rsaKeyring);
}
- @Test
+ @RetryingTest(3)
public void testEquals() {
// Create two identical MaterialsDescription objects
MaterialsDescription desc1 = MaterialsDescription.builder()
diff --git a/src/test/java/software/amazon/encryption/s3/materials/PartialRsaKeyPairTest.java b/src/test/java/software/amazon/encryption/s3/materials/PartialRsaKeyPairTest.java
index 9eeb7948f..23beb2909 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/PartialRsaKeyPairTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/PartialRsaKeyPairTest.java
@@ -3,7 +3,7 @@
package software.amazon.encryption.s3.materials;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.S3EncryptionClientException;
import java.security.KeyPair;
@@ -24,7 +24,7 @@ public static void setUp() throws NoSuchAlgorithmException {
RSA_KEY_PAIR = keyPairGen.generateKeyPair();
}
- @Test
+ @RetryingTest(3)
public void testGetPublicKey() {
PartialRsaKeyPair partialRsaKeyPair = new PartialRsaKeyPair(null, RSA_KEY_PAIR.getPublic());
@@ -33,7 +33,7 @@ public void testGetPublicKey() {
assertEquals(KEY_ALGORITHM, partialRsaKeyPair.getPublicKey().getAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testGetPrivateKey() {
PartialRsaKeyPair partialRsaKeyPair = new PartialRsaKeyPair(RSA_KEY_PAIR.getPrivate(), null);
@@ -42,12 +42,12 @@ public void testGetPrivateKey() {
assertEquals(KEY_ALGORITHM, partialRsaKeyPair.getPrivateKey().getAlgorithm());
}
- @Test
+ @RetryingTest(3)
public void testBothKeysNull() {
assertThrows(S3EncryptionClientException.class, () -> new PartialRsaKeyPair(null, null));
}
- @Test
+ @RetryingTest(3)
public void testBuilder() {
PartialRsaKeyPair expectedKeyPair = new PartialRsaKeyPair(RSA_KEY_PAIR);
@@ -59,7 +59,7 @@ public void testBuilder() {
assertEquals(expectedKeyPair, actualKeyPair);
}
- @Test
+ @RetryingTest(3)
public void testInequality() {
PartialRsaKeyPair firstKeyPair = new PartialRsaKeyPair(RSA_KEY_PAIR);
PartialRsaKeyPair onlyPublicKeyPair = new PartialRsaKeyPair(null, RSA_KEY_PAIR.getPublic());
@@ -71,7 +71,7 @@ public void testInequality() {
assertNotEquals(onlyPrivateKeyPair, onlyPublicKeyPair);
}
- @Test
+ @RetryingTest(3)
public void testHashCodeSameKeyPair() {
PartialRsaKeyPair firstKeyPair = new PartialRsaKeyPair(RSA_KEY_PAIR);
PartialRsaKeyPair secondKeyPair = new PartialRsaKeyPair(RSA_KEY_PAIR);
@@ -79,7 +79,7 @@ public void testHashCodeSameKeyPair() {
assertEquals(firstKeyPair.hashCode(), secondKeyPair.hashCode());
}
- @Test
+ @RetryingTest(3)
public void testHashCodeDifferentKeyPair() {
PartialRsaKeyPair firstKeyPair = new PartialRsaKeyPair(RSA_KEY_PAIR);
PartialRsaKeyPair secondKeyPair = new PartialRsaKeyPair(null, RSA_KEY_PAIR.getPublic());
diff --git a/src/test/java/software/amazon/encryption/s3/materials/RsaKeyringTest.java b/src/test/java/software/amazon/encryption/s3/materials/RsaKeyringTest.java
index 15f5dd15f..8069b4f02 100644
--- a/src/test/java/software/amazon/encryption/s3/materials/RsaKeyringTest.java
+++ b/src/test/java/software/amazon/encryption/s3/materials/RsaKeyringTest.java
@@ -2,19 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
package software.amazon.encryption.s3.materials;
-import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.RetryingTest;
import software.amazon.encryption.s3.S3EncryptionClientException;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class RsaKeyringTest {
- @Test
+ @RetryingTest(3)
public void buildAesKeyringWithNullSecureRandomFails() {
assertThrows(S3EncryptionClientException.class, () -> AesKeyring.builder().secureRandom(null));
}
- @Test
+ @RetryingTest(3)
public void buildAesKeyringWithNullDataKeyGeneratorFails() {
assertThrows(S3EncryptionClientException.class, () -> AesKeyring.builder().dataKeyGenerator(null));
}