Skip to content

Commit 8a8db22

Browse files
committed
Remove JDK 19-specific tests in TagsTest
See gh-3436 See gh-3437
1 parent 08573c6 commit 8a8db22

File tree

1 file changed

+2
-36
lines changed
  • micrometer-core/src/test/java/io/micrometer/core/instrument

1 file changed

+2
-36
lines changed

micrometer-core/src/test/java/io/micrometer/core/instrument/TagsTest.java

+2-36
Original file line numberDiff line numberDiff line change
@@ -329,26 +329,7 @@ void emptyShouldNotContainTags() {
329329
@Issue("#3313")
330330
@DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX,
331331
disabledReason = "Sun ThreadMXBean with allocation counter not available")
332-
@EnabledForJreRange(max = JRE.JAVA_18)
333332
void andEmptyDoesNotAllocate() {
334-
andEmptyDoesNotAllocate(0);
335-
}
336-
337-
// See https://github.com/micrometer-metrics/micrometer/issues/3436
338-
@Test
339-
@Issue("#3313")
340-
@DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX,
341-
disabledReason = "Sun ThreadMXBean with allocation counter not available")
342-
@EnabledIf("java19")
343-
void andEmptyDoesNotAllocateOnJava19() {
344-
andEmptyDoesNotAllocate(16);
345-
}
346-
347-
static boolean java19() {
348-
return "19".equals(System.getProperty("java.version"));
349-
}
350-
351-
private void andEmptyDoesNotAllocate(int expectedAllocatedBytes) {
352333
ThreadMXBean threadMXBean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
353334
long currentThreadId = Thread.currentThread().getId();
354335
Tags tags = Tags.of("a", "b");
@@ -359,29 +340,14 @@ private void andEmptyDoesNotAllocate(int expectedAllocatedBytes) {
359340
long allocatedBytes = threadMXBean.getThreadAllocatedBytes(currentThreadId) - allocatedBytesBefore;
360341

361342
assertThat(combined).isEqualTo(tags);
362-
assertThat(allocatedBytes).isEqualTo(expectedAllocatedBytes);
343+
assertThat(allocatedBytes).isEqualTo(0);
363344
}
364345

365346
@Test
366347
@Issue("#3313")
367348
@DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX,
368349
disabledReason = "Sun ThreadMXBean with allocation counter not available")
369-
@EnabledForJreRange(max = JRE.JAVA_18)
370350
void ofEmptyDoesNotAllocate() {
371-
ofEmptyDoesNotAllocate(0);
372-
}
373-
374-
// See https://github.com/micrometer-metrics/micrometer/issues/3436
375-
@Test
376-
@Issue("#3313")
377-
@DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX,
378-
disabledReason = "Sun ThreadMXBean with allocation counter not available")
379-
@EnabledIf("java19")
380-
void ofEmptyDoesNotAllocateOnJava19() {
381-
ofEmptyDoesNotAllocate(16);
382-
}
383-
384-
private void ofEmptyDoesNotAllocate(int expectedAllocatedBytes) {
385351
ThreadMXBean threadMXBean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
386352
long currentThreadId = Thread.currentThread().getId();
387353
Tags extraTags = Tags.empty();
@@ -391,7 +357,7 @@ private void ofEmptyDoesNotAllocate(int expectedAllocatedBytes) {
391357
long allocatedBytes = threadMXBean.getThreadAllocatedBytes(currentThreadId) - allocatedBytesBefore;
392358

393359
assertThat(of).isEqualTo(Tags.empty());
394-
assertThat(allocatedBytes).isEqualTo(expectedAllocatedBytes);
360+
assertThat(allocatedBytes).isEqualTo(0);
395361
}
396362

397363
private void assertTags(Tags tags, String... keyValues) {

0 commit comments

Comments
 (0)