From d50871cab77929928b819c81149ceae6031bffa3 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Thu, 28 Dec 2023 22:09:44 +0900 Subject: [PATCH] Remove JDK 19-specific tests in TagsTest (#4512) See gh-3436 See gh-3437 --- .../micrometer/core/instrument/TagsTest.java | 38 +------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/micrometer-core/src/test/java/io/micrometer/core/instrument/TagsTest.java b/micrometer-core/src/test/java/io/micrometer/core/instrument/TagsTest.java index b93d0c381d..09ffb3d0bf 100644 --- a/micrometer-core/src/test/java/io/micrometer/core/instrument/TagsTest.java +++ b/micrometer-core/src/test/java/io/micrometer/core/instrument/TagsTest.java @@ -329,26 +329,7 @@ void emptyShouldNotContainTags() { @Issue("#3313") @DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX, disabledReason = "Sun ThreadMXBean with allocation counter not available") - @EnabledForJreRange(max = JRE.JAVA_18) void andEmptyDoesNotAllocate() { - andEmptyDoesNotAllocate(0); - } - - // See https://github.com/micrometer-metrics/micrometer/issues/3436 - @Test - @Issue("#3313") - @DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX, - disabledReason = "Sun ThreadMXBean with allocation counter not available") - @EnabledIf("java19") - void andEmptyDoesNotAllocateOnJava19() { - andEmptyDoesNotAllocate(16); - } - - static boolean java19() { - return "19".equals(System.getProperty("java.version")); - } - - private void andEmptyDoesNotAllocate(int expectedAllocatedBytes) { ThreadMXBean threadMXBean = (ThreadMXBean) ManagementFactory.getThreadMXBean(); long currentThreadId = Thread.currentThread().getId(); Tags tags = Tags.of("a", "b"); @@ -359,29 +340,14 @@ private void andEmptyDoesNotAllocate(int expectedAllocatedBytes) { long allocatedBytes = threadMXBean.getThreadAllocatedBytes(currentThreadId) - allocatedBytesBefore; assertThat(combined).isEqualTo(tags); - assertThat(allocatedBytes).isEqualTo(expectedAllocatedBytes); + assertThat(allocatedBytes).isEqualTo(0); } @Test @Issue("#3313") @DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX, disabledReason = "Sun ThreadMXBean with allocation counter not available") - @EnabledForJreRange(max = JRE.JAVA_18) void ofEmptyDoesNotAllocate() { - ofEmptyDoesNotAllocate(0); - } - - // See https://github.com/micrometer-metrics/micrometer/issues/3436 - @Test - @Issue("#3313") - @DisabledIfSystemProperty(named = "java.vm.name", matches = JAVA_VM_NAME_J9_REGEX, - disabledReason = "Sun ThreadMXBean with allocation counter not available") - @EnabledIf("java19") - void ofEmptyDoesNotAllocateOnJava19() { - ofEmptyDoesNotAllocate(16); - } - - private void ofEmptyDoesNotAllocate(int expectedAllocatedBytes) { ThreadMXBean threadMXBean = (ThreadMXBean) ManagementFactory.getThreadMXBean(); long currentThreadId = Thread.currentThread().getId(); Tags extraTags = Tags.empty(); @@ -391,7 +357,7 @@ private void ofEmptyDoesNotAllocate(int expectedAllocatedBytes) { long allocatedBytes = threadMXBean.getThreadAllocatedBytes(currentThreadId) - allocatedBytesBefore; assertThat(of).isEqualTo(Tags.empty()); - assertThat(allocatedBytes).isEqualTo(expectedAllocatedBytes); + assertThat(allocatedBytes).isEqualTo(0); } private void assertTags(Tags tags, String... keyValues) {