You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/03/12 04:52:18 UTC

[GitHub] [incubator-inlong] luchunliang opened a new pull request #3081: [INLONG-2962] Unit tests throw so many error msg for DataProxy

luchunliang opened a new pull request #3081:
URL: https://github.com/apache/incubator-inlong/pull/3081


   ### Title Name: [INLONG-2962][DataProxy] Unit tests throw so many error msg for DataProxy 
   
   Fixes #2962 
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve.*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] luchunliang commented on a change in pull request #3081: [INLONG-2962][DataProxy] Unit tests throw so many error msg

Posted by GitBox <gi...@apache.org>.
luchunliang commented on a change in pull request #3081:
URL: https://github.com/apache/incubator-inlong/pull/3081#discussion_r825251495



##########
File path: inlong-dataproxy/dataproxy-source/src/test/java/org/apache/inlong/dataproxy/sink/TestPulsarSink.java
##########
@@ -47,33 +56,42 @@
     private int batchSize = 1;
 
     private PulsarSink sink;
-    private Channel channel;
+    private MemoryChannel channel;
 //    private ThirdPartyClusterConfig pulsarConfig = new ThirdPartyClusterConfig();
 //    private Map<String, String> url2token;
 
     @Mock
     private static ConfigManager configManager;
 
-    public void setUp() {
+    public void setUp() throws Exception {
+        // mock
+        MockUtils.mockMetricRegister();
+        PowerMockito.mockStatic(ReloadConfigWorker.class);
+        ReloadConfigWorker worker = PowerMockito.mock(ReloadConfigWorker.class);
+//        PowerMockito.doNothing().when(worker, "setDaemon", true);
+        PowerMockito.doNothing().when(worker, "start");
+        PowerMockito.when(ReloadConfigWorker.class, "create", any()).thenReturn(worker);
+        ConfigManager.getInstance().getCommonProperties().put(CONFIG_LOG_REPORT_ENABLE, "false");
+        // prepare
         sink = new PulsarSink();
         channel = new MemoryChannel();
 //        url2token = ConfigManager.getInstance().getThirdPartyClusterUrl2Token();
         Context context = new Context();
         context.put("type", "org.apache.inlong.dataproxy.sink.PulsarSink");
         sink.setChannel(channel);
 
-        Configurables.configure(sink, context);
-        Configurables.configure(channel, context);
+//        Configurables.configure(sink, context);

Review comment:
       removed it

##########
File path: inlong-dataproxy/dataproxy-source/src/test/java/org/apache/inlong/dataproxy/sink/TestPulsarSink.java
##########
@@ -84,13 +102,13 @@ public void testProcess() throws InterruptedException, EventDeliveryException,
         transaction.commit();
         transaction.close();
 
-        for (int i = 0; i < 5; i++) {
-            Sink.Status status = sink.process();
-            Assert.assertEquals(Sink.Status.READY, status);
-        }
-
-        sink.stop();
-        Assert.assertTrue(LifecycleController.waitForOneOf(sink,
-                LifecycleState.STOP_OR_ERROR, 5000));
+//        for (int i = 0; i < 5; i++) {

Review comment:
       removed it




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] dockerzhang merged pull request #3081: [INLONG-2962][DataProxy] Unit tests throw so many error msg

Posted by GitBox <gi...@apache.org>.
dockerzhang merged pull request #3081:
URL: https://github.com/apache/incubator-inlong/pull/3081


   


-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] healchow commented on a change in pull request #3081: [INLONG-2962][DataProxy] Unit tests throw so many error msg

Posted by GitBox <gi...@apache.org>.
healchow commented on a change in pull request #3081:
URL: https://github.com/apache/incubator-inlong/pull/3081#discussion_r825251339



##########
File path: inlong-dataproxy/dataproxy-source/src/test/java/org/apache/inlong/dataproxy/sink/TestPulsarSink.java
##########
@@ -47,33 +56,42 @@
     private int batchSize = 1;
 
     private PulsarSink sink;
-    private Channel channel;
+    private MemoryChannel channel;
 //    private ThirdPartyClusterConfig pulsarConfig = new ThirdPartyClusterConfig();
 //    private Map<String, String> url2token;
 
     @Mock
     private static ConfigManager configManager;
 
-    public void setUp() {
+    public void setUp() throws Exception {
+        // mock
+        MockUtils.mockMetricRegister();
+        PowerMockito.mockStatic(ReloadConfigWorker.class);
+        ReloadConfigWorker worker = PowerMockito.mock(ReloadConfigWorker.class);
+//        PowerMockito.doNothing().when(worker, "setDaemon", true);
+        PowerMockito.doNothing().when(worker, "start");
+        PowerMockito.when(ReloadConfigWorker.class, "create", any()).thenReturn(worker);
+        ConfigManager.getInstance().getCommonProperties().put(CONFIG_LOG_REPORT_ENABLE, "false");
+        // prepare
         sink = new PulsarSink();
         channel = new MemoryChannel();
 //        url2token = ConfigManager.getInstance().getThirdPartyClusterUrl2Token();
         Context context = new Context();
         context.put("type", "org.apache.inlong.dataproxy.sink.PulsarSink");
         sink.setChannel(channel);
 
-        Configurables.configure(sink, context);
-        Configurables.configure(channel, context);
+//        Configurables.configure(sink, context);

Review comment:
       Remove those unused codes.




-- 
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: commits-unsubscribe@inlong.apache.org

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



[GitHub] [incubator-inlong] healchow commented on a change in pull request #3081: [INLONG-2962][DataProxy] Unit tests throw so many error msg

Posted by GitBox <gi...@apache.org>.
healchow commented on a change in pull request #3081:
URL: https://github.com/apache/incubator-inlong/pull/3081#discussion_r825251373



##########
File path: inlong-dataproxy/dataproxy-source/src/test/java/org/apache/inlong/dataproxy/sink/TestPulsarSink.java
##########
@@ -84,13 +102,13 @@ public void testProcess() throws InterruptedException, EventDeliveryException,
         transaction.commit();
         transaction.close();
 
-        for (int i = 0; i < 5; i++) {
-            Sink.Status status = sink.process();
-            Assert.assertEquals(Sink.Status.READY, status);
-        }
-
-        sink.stop();
-        Assert.assertTrue(LifecycleController.waitForOneOf(sink,
-                LifecycleState.STOP_OR_ERROR, 5000));
+//        for (int i = 0; i < 5; i++) {

Review comment:
       Remove those unused codes.




-- 
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: commits-unsubscribe@inlong.apache.org

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