Skip to content

Commit a8601b3

Browse files
committed
Increase memory sampling to try and avoid flaky tests
1 parent 4e35c3b commit a8601b3

2 files changed

Lines changed: 4 additions & 21 deletions

File tree

ddprof-test/src/test/java/com/datadoghq/profiler/jfr/ObjectSampleDumpSmokeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected boolean isPlatformSupported() {
1515

1616
@Override
1717
protected String getProfilerCommand() {
18-
return "memory=1024:a";
18+
return "memory=128:a";
1919
}
2020

2121
@RetryingTest(5)

ddprof-test/src/test/java/com/datadoghq/profiler/memleak/GCGenerationsTest.java

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,20 @@
2020
public class GCGenerationsTest extends AbstractProfilerTest {
2121
@Override
2222
protected String getProfilerCommand() {
23-
return "generations=true,cstack=fp";
23+
return "memory=128,generations=true,cstack=fp";
2424
}
2525

2626
@Override
2727
protected boolean isPlatformSupported() {
2828
return !(Platform.isJavaVersion(8) || Platform.isJ9() || Platform.isZing());
2929
}
3030

31-
@RetryingTest(5)
31+
@RetryingTest(10)
3232
public void shouldGetLiveObjectSamples() throws InterruptedException {
3333
MemLeakTarget target1 = new MemLeakTarget();
3434
MemLeakTarget target2 = new MemLeakTarget();
3535
runTests(target1, target2);
36-
IItemCollection allocations = verifyEvents("datadog.HeapLiveObject");
37-
38-
// assertAllocations(allocations, int[].class, target1, target2);
39-
// assertAllocations(allocations, Integer[].class, target1, target2);
40-
}
41-
42-
private static void assertAllocations(IItemCollection allocations, Class<?> clazz, MemLeakTarget... targets) {
43-
long allocated = 0;
44-
for (MemLeakTarget target : targets) {
45-
allocated += target.getAllocated(clazz);
46-
}
47-
IItemCollection allocationsByType = allocations.apply(allocatedTypeFilter(clazz.getCanonicalName()));
48-
assertTrue(allocationsByType.hasItems());
49-
long recorded = allocationsByType.getAggregate(Aggregators.sum(SCALED_SIZE)).longValue();
50-
long absoluteError = Math.abs(recorded - allocated);
51-
assertTrue(absoluteError < allocated / 10,
52-
String.format("allocation samples should be within 10pct tolerance of allocated memory (recorded %d, allocated %d)",
53-
recorded, allocated));
36+
verifyEvents("datadog.HeapLiveObject");
5437
}
5538

5639
public static class MemLeakTarget extends ClassValue<AtomicLong> implements Runnable {

0 commit comments

Comments
 (0)