You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "1996fanrui (via GitHub)" <gi...@apache.org> on 2023/08/11 16:02:38 UTC

[GitHub] [flink] 1996fanrui opened a new pull request, #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

1996fanrui opened a new pull request, #23198:
URL: https://github.com/apache/flink/pull/23198

   [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] 1996fanrui merged pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui merged PR #23198:
URL: https://github.com/apache/flink/pull/23198


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] 1996fanrui commented on a diff in pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on code in PR #23198:
URL: https://github.com/apache/flink/pull/23198#discussion_r1294318376


##########
flink-runtime/src/test/java/org/apache/flink/runtime/testutils/PseudoRandomValueSelectorTest.java:
##########
@@ -34,25 +34,20 @@
 import static org.apache.flink.configuration.CheckpointingOptions.SAVEPOINT_DIRECTORY;
 import static org.apache.flink.configuration.JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB;
 import static org.apache.flink.configuration.TaskManagerOptions.CPU_CORES;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeFalse;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assume.assumeNoException;
 import static org.junit.Assume.assumeNotNull;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
 
 /** Tests {@link PseudoRandomValueSelector}. */
-public class PseudoRandomValueSelectorTest extends TestLogger {
+class PseudoRandomValueSelectorTest extends TestLogger {

Review Comment:
   Thanks @X-czh  for the review, I will remove the `TestLogger` later. And this PR isn't to ready, I mark it to a draft PR.
   
   I will let you know after it's ready.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] X-czh commented on a diff in pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "X-czh (via GitHub)" <gi...@apache.org>.
X-czh commented on code in PR #23198:
URL: https://github.com/apache/flink/pull/23198#discussion_r1296189640


##########
flink-runtime/src/test/java/org/apache/flink/runtime/testutils/TestJvmProcess.java:
##########
@@ -316,18 +317,16 @@ public static void waitForMarkerFile(File file, long timeoutMillis)
             Thread.sleep(10);
         }
 
-        if (!exists) {
-            fail("The marker file was not found within " + timeoutMillis + " msecs");
-        }
+        assertThat(exists)
+                .as("The marker file was not found within " + timeoutMillis + " msecs")
+                .isTrue();
     }
 
     public static void killProcessWithSigTerm(long pid) throws Exception {
         // send it a regular kill command (SIG_TERM)
         final Process kill = Runtime.getRuntime().exec("kill " + pid);
         kill.waitFor();
-        if (kill.exitValue() != 0) {
-            fail("failed to send SIG_TERM to process " + pid);
-        }
+        assertThat(kill.exitValue()).as("failed to send SIG_TERM to process " + pid).isZero();

Review Comment:
   same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] X-czh commented on a diff in pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "X-czh (via GitHub)" <gi...@apache.org>.
X-czh commented on code in PR #23198:
URL: https://github.com/apache/flink/pull/23198#discussion_r1292712889


##########
flink-runtime/src/test/java/org/apache/flink/runtime/testutils/PseudoRandomValueSelectorTest.java:
##########
@@ -34,25 +34,20 @@
 import static org.apache.flink.configuration.CheckpointingOptions.SAVEPOINT_DIRECTORY;
 import static org.apache.flink.configuration.JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB;
 import static org.apache.flink.configuration.TaskManagerOptions.CPU_CORES;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeFalse;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assume.assumeNoException;
 import static org.junit.Assume.assumeNotNull;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
 
 /** Tests {@link PseudoRandomValueSelector}. */
-public class PseudoRandomValueSelectorTest extends TestLogger {
+class PseudoRandomValueSelectorTest extends TestLogger {

Review Comment:
   We should replace usage of TestLogger with TestLoggerExtension
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] X-czh commented on pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "X-czh (via GitHub)" <gi...@apache.org>.
X-czh commented on PR #23198:
URL: https://github.com/apache/flink/pull/23198#issuecomment-1683231044

   Thanks, LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] X-czh commented on a diff in pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "X-czh (via GitHub)" <gi...@apache.org>.
X-czh commented on code in PR #23198:
URL: https://github.com/apache/flink/pull/23198#discussion_r1296189347


##########
flink-runtime/src/test/java/org/apache/flink/runtime/testutils/TestJvmProcess.java:
##########
@@ -316,18 +317,16 @@ public static void waitForMarkerFile(File file, long timeoutMillis)
             Thread.sleep(10);
         }
 
-        if (!exists) {
-            fail("The marker file was not found within " + timeoutMillis + " msecs");
-        }
+        assertThat(exists)
+                .as("The marker file was not found within " + timeoutMillis + " msecs")

Review Comment:
   Better to replace `as` with `withFailMessage` as the message is not a description of the check but rather an enriched error message. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] X-czh commented on pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "X-czh (via GitHub)" <gi...@apache.org>.
X-czh commented on PR #23198:
URL: https://github.com/apache/flink/pull/23198#issuecomment-1680956906

   Thanks for your contribution! Overall LGTM with minor comments.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #23198:
URL: https://github.com/apache/flink/pull/23198#issuecomment-1675031246

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2d11dcf6252d521b19b36afce501f8ecc2422941",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2d11dcf6252d521b19b36afce501f8ecc2422941",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2d11dcf6252d521b19b36afce501f8ecc2422941 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] 1996fanrui commented on a diff in pull request #23198: [FLINK-32856][JUnit5 Migration] Migrate the testutils, throughput and throwable packages of flink-runtime module to junit5

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on code in PR #23198:
URL: https://github.com/apache/flink/pull/23198#discussion_r1297192247


##########
flink-runtime/src/test/java/org/apache/flink/runtime/testutils/TestJvmProcess.java:
##########
@@ -316,18 +317,16 @@ public static void waitForMarkerFile(File file, long timeoutMillis)
             Thread.sleep(10);
         }
 
-        if (!exists) {
-            fail("The marker file was not found within " + timeoutMillis + " msecs");
-        }
+        assertThat(exists)
+                .as("The marker file was not found within " + timeoutMillis + " msecs")

Review Comment:
   Thanks @X-czh 's review, updated!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org