Skip to content

Commit

Permalink
Attempt to fix sporadic test failing with OOM
Browse files Browse the repository at this point in the history
Troubleshooting flaky test failing with OOM
  • Loading branch information
ggivo committed Jan 15, 2025
1 parent f9977e4 commit 0f03d59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test-on-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,19 @@ jobs:
mvn -Dtest=$TESTS clean compile test
fi
env:
JVM_OPTS: "-XX:+PrintFlagsFinal -XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof"
TESTS: ${{ github.event.inputs.specific_test || '' }}
- name: Upload Heap Dumps
if: failure()
uses: actions/upload-artifact@v4
with:
name: heap-dumps-${{ matrix.redis_version }}
path: ${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof
- name: Upload Surefire Dump File
uses: actions/upload-artifact@v3
with:
name: surefire-dumpstream
path: target/surefire-reports/*.dumpstream
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<argLine>${JVM_OPTS}</argLine>
<systemPropertyVariables>
<redis-hosts>${redis-hosts}</redis-hosts>
</systemPropertyVariables>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void evict() throws Exception {

await().pollInterval(ONE_HUNDRED_MILLISECONDS).atMost(FIVE_HUNDRED_MILLISECONDS)
.until(numberOfEvictions::get, Matchers.greaterThanOrEqualTo(1));
pool.close();
}

public void withLowerRefreshBounds_testJedisAuthXManagerTriggersEvict() throws Exception {
Expand All @@ -108,6 +109,7 @@ public void evict() throws Exception {

await().pollInterval(ONE_HUNDRED_MILLISECONDS).atMost(FIVE_HUNDRED_MILLISECONDS)
.until(numberOfEvictions::get, Matchers.greaterThanOrEqualTo(1));
pool.close();
}

public static class TokenManagerConfigWrapper extends TokenManagerConfig {
Expand Down Expand Up @@ -229,6 +231,7 @@ public void testAuthXManagerReceivesNewToken()

manager.start();
assertEquals(tokenHolder[0].getValue(), "tokenVal");
manager.stop();
}

@Test
Expand Down Expand Up @@ -300,6 +303,7 @@ public void testTokenManagerWithFailingTokenRequest()
verify(identityProvider, times(numberOfRetries)).requestToken();
verify(listener, never()).onError(any());
assertEquals("tokenValX", argument.getValue().getValue());
tokenManager.stop();
}

@Test
Expand Down Expand Up @@ -338,5 +342,6 @@ public void testTokenManagerWithHangingTokenRequest()
await().atMost(2, TimeUnit.SECONDS).untilAsserted(() -> {
verify(manager, times(1)).authenticateConnections(any());
});
manager.stop();
}
}

0 comments on commit 0f03d59

Please sign in to comment.