From 4595318cb7335faef4f1740edc90bdf926092b2e Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Fri, 21 Feb 2025 13:10:13 +0100 Subject: [PATCH] Try avoiding flakyness in ObjectSampleDumpSmokeTest --- .../test/java/com/datadoghq/profiler/jfr/JfrDumpTest.java | 6 +++++- .../datadoghq/profiler/jfr/ObjectSampleDumpSmokeTest.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/JfrDumpTest.java b/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/JfrDumpTest.java index 7fe223c8..210842af 100644 --- a/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/JfrDumpTest.java +++ b/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/JfrDumpTest.java @@ -16,10 +16,14 @@ public void runTest(String eventName) throws Exception { } public void runTest(String eventName, String ... patterns) throws Exception { + runTest(eventName, 10, patterns); + } + + public void runTest(String eventName, int dumpCnt, String ... patterns) throws Exception { Assumptions.assumeTrue(Platform.isJavaVersionAtLeast(11)); Assumptions.assumeFalse(Platform.isJ9()); - for (int j = 0; j < 10; j++) { + for (int j = 0; j < dumpCnt; j++) { Path recording = Files.createTempFile("dump-", ".jfr"); try { for (int i = 0; i < 50; i++) { diff --git a/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/ObjectSampleDumpSmokeTest.java b/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/ObjectSampleDumpSmokeTest.java index 9cc1df59..8582783a 100644 --- a/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/ObjectSampleDumpSmokeTest.java +++ b/ddprof-test/src/test/java/com/datadoghq/profiler/jfr/ObjectSampleDumpSmokeTest.java @@ -21,6 +21,6 @@ protected String getProfilerCommand() { @RetryingTest(5) @Timeout(value = 300) public void test() throws Exception { - runTest("datadog.ObjectSample", "method3"); + runTest("datadog.ObjectSample", 3, "method3"); } }