Skip to content

Commit d6586ce

Browse files
authored
bump timings to make samples more certain (#2567)
1 parent 55deb8b commit d6586ce

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ void testProfileTransaction() throws Exception {
178178
// makes sure that the rest will be captured by another profiling session
179179
// this tests that restoring which threads to profile works
180180
int currentSession = setup.profiler.getProfilingSessions();
181-
await().until(() -> setup.profiler.getProfilingSessions() > currentSession);
181+
await()
182+
.timeout(Duration.ofSeconds(10))
183+
.until(() -> setup.profiler.getProfilingSessions() > currentSession);
182184
profilingActiveOnThread = setup.profiler.isProfilingActiveOnThread(Thread.currentThread());
183185
aInferred(tracer);
184186
} finally {
@@ -187,7 +189,7 @@ void testProfileTransaction() throws Exception {
187189

188190
await()
189191
.pollDelay(Duration.ofMillis(10))
190-
.timeout(Duration.ofSeconds(5))
192+
.timeout(Duration.ofSeconds(10))
191193
.untilAsserted(
192194
() -> {
193195
assertThat(setup.getSpans()).hasSizeGreaterThanOrEqualTo(6);
@@ -283,15 +285,15 @@ void testPostProcessingDisabled() throws Exception {
283285
try (Scope scope = tx.makeCurrent()) {
284286
// makes sure that the rest will be captured by another profiling session
285287
// this tests that restoring which threads to profile works
286-
Thread.sleep(600);
288+
Thread.sleep(3000);
287289
aInferred(tracer);
288290
} finally {
289291
tx.end();
290292
}
291293

292294
await()
293295
.pollDelay(Duration.ofMillis(10))
294-
.timeout(Duration.ofSeconds(5))
296+
.timeout(Duration.ofSeconds(10))
295297
.untilAsserted(() -> assertThat(setup.getSpans()).hasSize(2));
296298

297299
Optional<SpanData> explicitSpanB =
@@ -307,16 +309,16 @@ private static void aInferred(Tracer tracer) throws Exception {
307309
} finally {
308310
span.end();
309311
}
310-
Thread.sleep(50);
312+
Thread.sleep(200);
311313
}
312314

313315
private static void cInferred() throws Exception {
314316
dInferred();
315-
Thread.sleep(50);
317+
Thread.sleep(200);
316318
}
317319

318320
private static void dInferred() throws Exception {
319-
Thread.sleep(50);
321+
Thread.sleep(200);
320322
}
321323

322324
private void setupProfiler(boolean enabled) {
@@ -328,8 +330,8 @@ private void setupProfiler(Consumer<InferredSpansProcessorBuilder> configCustomi
328330
ProfilerTestSetup.create(
329331
config -> {
330332
config
331-
.profilingDuration(Duration.ofMillis(500))
332-
.profilerInterval(Duration.ofMillis(500))
333+
.profilingDuration(Duration.ofMillis(2500))
334+
.profilerInterval(Duration.ofMillis(2500))
333335
.samplingInterval(Duration.ofMillis(5))
334336
.tempDir(tempDir.toFile());
335337
configCustomizer.accept(config);
@@ -340,7 +342,7 @@ private static void awaitProfilerStarted(SamplingProfiler profiler) {
340342
// ensure profiler is initialized
341343
await()
342344
.pollDelay(Duration.ofMillis(10))
343-
.timeout(Duration.ofSeconds(6))
345+
.timeout(Duration.ofSeconds(10))
344346
.until(() -> profiler.getProfilingSessions() > 1);
345347
}
346348
}

0 commit comments

Comments
 (0)