Skip to content

Commit aecd95d

Browse files
committed
Merge branch '1.15.x' into 1.16.x
2 parents 991f09c + cd83609 commit aecd95d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

implementations/micrometer-registry-statsd/src/test/java/io/micrometer/statsd/StatsdMeterRegistryPublishTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ void receiveParallelMetricsSuccessfully(StatsdProtocol protocol) throws Interrup
331331

332332
@Test
333333
void counterIncrementWorksWithSleepAfterRegistryStart() throws InterruptedException {
334-
StatsdConfig config = StatsdConfig.DEFAULT;
335-
336334
CountDownLatch serverLatch = new CountDownLatch(1);
337-
DisposableChannel server = startServer(StatsdProtocol.UDP, config.port(), serverLatch);
335+
DisposableChannel server = startServer(StatsdProtocol.UDP, 0, serverLatch);
336+
final int port = getPort(server, StatsdProtocol.UDP);
338337

339-
StatsdMeterRegistry registry = new StatsdMeterRegistry(config, Clock.SYSTEM);
338+
StatsdMeterRegistry registry = new StatsdMeterRegistry(getBufferedConfig(StatsdProtocol.UDP, port),
339+
Clock.SYSTEM);
340340
Thread.sleep(1000);
341341

342342
Counter counter = Counter.builder("my.counter").register(registry);
@@ -351,12 +351,12 @@ void counterIncrementWorksWithSleepAfterRegistryStart() throws InterruptedExcept
351351

352352
@Test
353353
void counterIncrementDoesNotWorkWithoutSleepAfterRegistryStart() throws InterruptedException {
354-
StatsdConfig config = StatsdConfig.DEFAULT;
355-
356354
CountDownLatch serverLatch = new CountDownLatch(1);
357-
DisposableChannel server = startServer(StatsdProtocol.UDP, config.port(), serverLatch);
355+
DisposableChannel server = startServer(StatsdProtocol.UDP, 0, serverLatch);
356+
final int port = getPort(server, StatsdProtocol.UDP);
358357

359-
StatsdMeterRegistry registry = new StatsdMeterRegistry(config, Clock.SYSTEM);
358+
StatsdMeterRegistry registry = new StatsdMeterRegistry(getBufferedConfig(StatsdProtocol.UDP, port),
359+
Clock.SYSTEM);
360360

361361
Counter counter = Counter.builder("my.counter").register(registry);
362362
counter.increment();

0 commit comments

Comments
 (0)