This is an automated email from the ASF dual-hosted git repository.

snuyanzin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new b3fb1421fe8 [FLINK-32951][tests] Make 
VertexFlameGraphFactoryTest#testLambdaClassNamesCleanUp working with jdk 11+ 
(#23284)
b3fb1421fe8 is described below

commit b3fb1421fe86129a4e0b10bf3a46704b7132e775
Author: Sergey Nuyanzin <snuyan...@gmail.com>
AuthorDate: Thu Aug 24 19:54:26 2023 +0200

    [FLINK-32951][tests] Make 
VertexFlameGraphFactoryTest#testLambdaClassNamesCleanUp working with jdk 11+ 
(#23284)
---
 .../threadinfo/VertexFlameGraphFactoryTest.java        | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git 
a/flink-runtime/src/test/java/org/apache/flink/runtime/webmonitor/threadinfo/VertexFlameGraphFactoryTest.java
 
b/flink-runtime/src/test/java/org/apache/flink/runtime/webmonitor/threadinfo/VertexFlameGraphFactoryTest.java
index 583f8ae83f0..c0a38160523 100644
--- 
a/flink-runtime/src/test/java/org/apache/flink/runtime/webmonitor/threadinfo/VertexFlameGraphFactoryTest.java
+++ 
b/flink-runtime/src/test/java/org/apache/flink/runtime/webmonitor/threadinfo/VertexFlameGraphFactoryTest.java
@@ -23,8 +23,8 @@ import 
org.apache.flink.runtime.executiongraph.ExecutionGraphID;
 import org.apache.flink.runtime.jobgraph.JobVertexID;
 import org.apache.flink.runtime.messages.ThreadInfoSample;
 import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
-import org.apache.flink.util.TestLogger;
 
+import org.assertj.core.api.Condition;
 import org.junit.jupiter.api.Test;
 
 import java.lang.management.ManagementFactory;
@@ -40,10 +40,10 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.fail;
 
 /** Tests for {@link VertexFlameGraphFactory}. */
-public class VertexFlameGraphFactoryTest extends TestLogger {
+class VertexFlameGraphFactoryTest {
     /** Tests that lambda class names are cleaned up inside the stack traces. 
*/
     @Test
-    public void testLambdaClassNamesCleanUp() {
+    void testLambdaClassNamesCleanUp() {
         Map<ExecutionAttemptID, Collection<ThreadInfoSample>> samplesBySubtask 
= generateSamples();
 
         VertexThreadInfoStats sample = new VertexThreadInfoStats(0, 0, 0, 
samplesBySubtask);
@@ -67,7 +67,17 @@ public class VertexFlameGraphFactoryTest extends TestLogger {
             String className =
                     locationWithoutLineNumber.substring(
                             0, locationWithoutLineNumber.lastIndexOf("."));
-            assertThat(className).endsWith("$Lambda$0/0");
+            assertThat(className)
+                    .is(
+                            new Condition<String>() {
+                                @Override
+                                public boolean matches(String value) {
+                                    String javaVersion = 
System.getProperty("java.version");
+                                    return javaVersion.startsWith("1.8")
+                                                    && 
value.endsWith("$Lambda$0/0")
+                                            || value.endsWith("$Lambda$0/0x0");
+                                }
+                            });
         }
         return lambdas + 
node.getChildren().stream().mapToInt(this::verifyRecursively).sum();
     }

Reply via email to