You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2020/05/03 17:07:20 UTC

[GitHub] [incubator-hudi] xushiyan opened a new pull request #1589: [HUDI-813] Migrate hudi-utilities tests to JUnit 5

xushiyan opened a new pull request #1589:
URL: https://github.com/apache/incubator-hudi/pull/1589


   Migrate the test cases in hudi-utilities to JUnit 5.
   
   Follows #1570 
   
   ### Migration status (after merging)
   
   | Package | JUnit 5 lib | API migration | Restructure packages |
   | --- | --- | --- | --- |
   | `hudi-cli` | ✅ | ✅ | - |
   | `hudi-client` | ✅ | ✅ | - |
   | `hudi-common` | ✅ | 🚧 | 🚧 |
   | `hudi-hadoop-mr` | ✅ | ✅ | - |
   | `hudi-hive-sync` | ✅ | ✅ | - |
   | `hudi-integ-test` | ✅ | ✅  | N.A. |
   | `hudi-spark` | ✅ | ✅ | - |
   | `hudi-timeline-service` | ✅ | ✅ | - |
   | `hudi-utilities` | ✅ | ✅ | - |
   
   ## Committer checklist
   
    - [ ] Has a corresponding JIRA in PR title & commit
    
    - [ ] Commit message is descriptive of the change
    
    - [ ] CI is green
   
    - [ ] Necessary doc changes done or have another open PR
          
    - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.


----------------------------------------------------------------
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.

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



[GitHub] [incubator-hudi] xushiyan commented on a change in pull request #1589: [HUDI-813] Migrate hudi-utilities tests to JUnit 5

Posted by GitBox <gi...@apache.org>.
xushiyan commented on a change in pull request #1589:
URL: https://github.com/apache/incubator-hudi/pull/1589#discussion_r419131896



##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestHiveIncrementalPuller.java
##########
@@ -18,27 +18,26 @@
 
 package org.apache.hudi.utilities;
 
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 
 public class TestHiveIncrementalPuller {
 
   private HiveIncrementalPuller.Config config;
 
-  @Before
+  @BeforeEach
   public void setup() {
     config = new HiveIncrementalPuller.Config();
   }
 
   @Test
   public void testInitHiveIncrementalPuller() {
 
-    try {
+    assertDoesNotThrow(() -> {
       new HiveIncrementalPuller(config);
-    } catch (Exception e) {
-      Assert.fail("Unexpected exception while initing HiveIncrementalPuller, msg: " + e.getMessage());
-    }
+    }, "Unexpected exception while initing HiveIncrementalPuller.");

Review comment:
       `e.getMessage()` will be included in message printed by `assertDoesNotThrow()` hence no need to concat it manually.

##########
File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestHoodieDeltaStreamer.java
##########
@@ -413,37 +412,33 @@ public void testKafkaConnectCheckpointProvider() throws IOException {
     HoodieTestDataGenerator dataGenerator = new HoodieTestDataGenerator();
     Helpers.saveParquetToDFS(Helpers.toGenericRecords(dataGenerator.generateInserts("000", 100)), new Path(filePath));
     HoodieDeltaStreamer deltaStreamer = new HoodieDeltaStreamer(cfg, jsc, dfs, hdfsTestService.getHadoopConf(), props);
-    assertEquals(deltaStreamer.getConfig().checkpoint, "kafka_topic1,0:200");
+    assertEquals("kafka_topic1,0:200", deltaStreamer.getConfig().checkpoint);
   }
 
   @Test
   public void testPropsWithInvalidKeyGenerator() throws Exception {
-    try {
+    Exception e = assertThrows(IOException.class, () -> {
       String tableBasePath = dfsBasePath + "/test_table";
       HoodieDeltaStreamer deltaStreamer =
           new HoodieDeltaStreamer(TestHelpers.makeConfig(tableBasePath, Operation.BULK_INSERT,
               Collections.singletonList(TripsWithDistanceTransformer.class.getName()), PROPS_FILENAME_TEST_INVALID, false), jsc);
       deltaStreamer.sync();
-      fail("Should error out when setting the key generator class property to an invalid value");
-    } catch (IOException e) {
-      // expected
-      LOG.error("Expected error during getting the key generator", e);
-      assertTrue(e.getMessage().contains("Could not load key generator class"));
-    }
+    }, "Should error out when setting the key generator class property to an invalid value");
+    // expected
+    LOG.debug("Expected error during getting the key generator", e);
+    assertTrue(e.getMessage().contains("Could not load key generator class"));

Review comment:
       Changing log level from error to debug. It is a good practice to not print anything unless test case failed thus we tend to mute the output here when it's passing. Same to other similar changes below.




----------------------------------------------------------------
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.

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



[GitHub] [incubator-hudi] codecov-io commented on pull request #1589: [HUDI-813] Migrate hudi-utilities tests to JUnit 5

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1589:
URL: https://github.com/apache/incubator-hudi/pull/1589#issuecomment-623151141


   # [Codecov](https://codecov.io/gh/apache/incubator-hudi/pull/1589?src=pr&el=h1) Report
   > Merging [#1589](https://codecov.io/gh/apache/incubator-hudi/pull/1589?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-hudi/commit/506447fd4fde4cd922f7aa8f4e17a7f06666dc97&el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-hudi/pull/1589/graphs/tree.svg?width=650&height=150&src=pr&token=VTTXabwbs2)](https://codecov.io/gh/apache/incubator-hudi/pull/1589?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #1589   +/-   ##
   =========================================
     Coverage     71.82%   71.82%           
     Complexity      294      294           
   =========================================
     Files           385      385           
     Lines         16549    16549           
     Branches       1661     1661           
   =========================================
     Hits          11886    11886           
     Misses         3931     3931           
     Partials        732      732           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-hudi/pull/1589?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-hudi/pull/1589?src=pr&el=footer). Last update [506447f...d71d318](https://codecov.io/gh/apache/incubator-hudi/pull/1589?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-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.

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