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 05:37:34 UTC

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

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