From b4d88f1f9e2f3adb86589cdaaa68c2b117fd7d78 Mon Sep 17 00:00:00 2001 From: sharmabikram Date: Fri, 10 Apr 2026 11:28:00 -0700 Subject: [PATCH] chore(java): attempt to reduce flaky CI failures (#2203) --- .github/workflows/ci_test_vector_java.yml | 1 + .../providers/CachingMostRecentProviderTests.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_test_vector_java.yml b/.github/workflows/ci_test_vector_java.yml index ff839527e4..5fcf6e15b1 100644 --- a/.github/workflows/ci_test_vector_java.yml +++ b/.github/workflows/ci_test_vector_java.yml @@ -26,6 +26,7 @@ on: jobs: testJava: strategy: + fail-fast: false matrix: library: [TestVectors] java-version: [8, 11, 17, 19] diff --git a/DynamoDbEncryption/runtimes/java/src/test/sdkv1/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/CachingMostRecentProviderTests.java b/DynamoDbEncryption/runtimes/java/src/test/sdkv1/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/CachingMostRecentProviderTests.java index ee82d1b012..32cfb1fbec 100644 --- a/DynamoDbEncryption/runtimes/java/src/test/sdkv1/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/CachingMostRecentProviderTests.java +++ b/DynamoDbEncryption/runtimes/java/src/test/sdkv1/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/CachingMostRecentProviderTests.java @@ -190,8 +190,9 @@ public void testSingleVersion() throws InterruptedException { 0, store.getVersionFromMaterialDescription(eMat2.getMaterialDescription()) ); - // Let the TTL be exceeded - Thread.sleep(500); + // Let the TTL be exceeded; sleep must be > TTL (500ms) to reliably + // land in the grace period and trigger a cache refresh. + Thread.sleep(700); final EncryptionMaterials eMat3 = prov.getEncryptionMaterials(ctx); assertEquals(2, methodCalls.size()); assertEquals(1, (int) methodCalls.getOrDefault("query", 0)); // To find current version @@ -356,8 +357,9 @@ public void testTwoVersions() throws InterruptedException { "Expected no calls but was " + methodCalls.toString(), methodCalls.isEmpty() ); - // Let the TTL be exceeded - Thread.sleep(500); + // Let the TTL be exceeded; sleep must be > TTL (500ms) to reliably + // land in the grace period and trigger a cache refresh. + Thread.sleep(700); final EncryptionMaterials eMat3 = prov.getEncryptionMaterials(ctx); assertEquals(1, (int) methodCalls.getOrDefault("query", 0)); // To find current version @@ -512,8 +514,9 @@ public void testSingleVersionTwoMaterials() throws InterruptedException { store.getVersionFromMaterialDescription(eMat2_2.getMaterialDescription()) ); - // Let the TTL be exceeded - Thread.sleep(500); + // Let the TTL be exceeded; sleep must be > TTL (500ms) to reliably + // land in the grace period and trigger a cache refresh. + Thread.sleep(700); final EncryptionMaterials eMat3_1 = prov.getEncryptionMaterials(ctx1); assertEquals(2, methodCalls.size()); assertEquals(1, (int) methodCalls.get("query")); // To find current version