You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by eo...@apache.org on 2022/06/24 11:42:10 UTC

[pulsar] branch master updated: [cleanup][functions] Realign Functions integration test classes (#16127)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new c10ffa1c149 [cleanup][functions] Realign Functions integration test classes (#16127)
c10ffa1c149 is described below

commit c10ffa1c149156b26d7e98450e2d1412e23b3dc9
Author: Christophe Bornet <cb...@hotmail.com>
AuthorDate: Fri Jun 24 13:42:05 2022 +0200

    [cleanup][functions] Realign Functions integration test classes (#16127)
---
 .../functions/go/PulsarFunctionsGoProcessTest.java |   6 +-
 .../functions/go/PulsarFunctionsGoThreadTest.java  |   6 +-
 .../java/PulsarFunctionsJavaProcessTest.java       |   6 +-
 .../functions/java/PulsarFunctionsJavaTest.java    | 246 ++++++++++-----------
 .../java/PulsarFunctionsJavaThreadTest.java        |   6 +-
 .../PulsarWorkerRebalanceDrainProcessTest.java     |   6 +-
 .../java/PulsarWorkerRebalanceDrainThreadTest.java |   6 +-
 .../python/PulsarFunctionsPythonProcessTest.java   |   6 +-
 .../python/PulsarFunctionsPythonThreadTest.java    |   2 +-
 9 files changed, 145 insertions(+), 145 deletions(-)

diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoProcessTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoProcessTest.java
index 348cf50682b..939f79150b9 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoProcessTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoProcessTest.java
@@ -22,8 +22,8 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarFunctionsGoProcessTest extends PulsarFunctionsGoTest {
 
-	PulsarFunctionsGoProcessTest() {
-		super(FunctionRuntimeType.PROCESS);
-	}
+    PulsarFunctionsGoProcessTest() {
+        super(FunctionRuntimeType.PROCESS);
+    }
 
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoThreadTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoThreadTest.java
index 6d70707eedf..a63e0b1f4b5 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoThreadTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/go/PulsarFunctionsGoThreadTest.java
@@ -22,7 +22,7 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarFunctionsGoThreadTest extends PulsarFunctionsGoTest {
 
-	PulsarFunctionsGoThreadTest() {
-		super(FunctionRuntimeType.THREAD);
-	}
+    PulsarFunctionsGoThreadTest() {
+        super(FunctionRuntimeType.THREAD);
+    }
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaProcessTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaProcessTest.java
index 71c6cb07fad..621352d5408 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaProcessTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaProcessTest.java
@@ -22,8 +22,8 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarFunctionsJavaProcessTest extends PulsarFunctionsJavaTest {
 
-	public PulsarFunctionsJavaProcessTest() {
-		super(FunctionRuntimeType.PROCESS);
-	}
+    public PulsarFunctionsJavaProcessTest() {
+        super(FunctionRuntimeType.PROCESS);
+    }
 
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaTest.java
index 6e496214219..3c3fe4254e0 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaTest.java
@@ -34,134 +34,134 @@ import org.testng.annotations.Test;
 
 public class PulsarFunctionsJavaTest extends PulsarFunctionsTest {
 
-	PulsarFunctionsJavaTest(FunctionRuntimeType functionRuntimeType) {
-		super(functionRuntimeType);
-	}
+    PulsarFunctionsJavaTest(FunctionRuntimeType functionRuntimeType) {
+        super(functionRuntimeType);
+    }
 
-   @Test(groups = {"java_function", "function"})
+    @Test(groups = {"java_function", "function"})
     public void testJavaFunctionLocalRun() throws Exception {
         testFunctionLocalRun(Runtime.JAVA);
     }
 
-   @Test(groups = {"java_function", "function"})
-   public void testJavaFunctionNegAck() throws Exception {
-       testFunctionNegAck(Runtime.JAVA);
-   }
-
-   @Test(groups = {"java_function", "function"})
-   public void testJavaPublishFunction() throws Exception {
-       testPublishFunction(Runtime.JAVA);
-   }
-
-   @Test(groups = {"java_function", "function"})
-   public void testSerdeFunction() throws Exception {
-       testCustomSerdeFunction();
-   }
-
-   private void testCustomSerdeFunction() throws Exception {
-       if (functionRuntimeType == FunctionRuntimeType.THREAD) {
-           return;
-       }
-
-       String inputTopicName = "persistent://public/default/test-serde-java-input-" + randomName(8);
-       String outputTopicName = "test-publish-serde-output-" + randomName(8);
-       try (PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarCluster.getHttpServiceUrl()).build()) {
-           admin.topics().createNonPartitionedTopic(inputTopicName);
-           admin.topics().createNonPartitionedTopic(outputTopicName);
-       }
-
-       String functionName = "test-serde-fn-" + randomName(8);
-       submitFunction(
-               Runtime.JAVA, inputTopicName, outputTopicName, functionName, null, SERDE_JAVA_CLASS,
-               SERDE_OUTPUT_CLASS, Collections.singletonMap("serde-topic", outputTopicName)
-       );
-
-       // get function info
-       getFunctionInfoSuccess(functionName);
-       // get function stats
-       getFunctionStatsEmpty(functionName);
-
-       ContainerExecResult result = pulsarCluster.getAnyWorker().execCmd(
-               PulsarCluster.ADMIN_SCRIPT,
-               "functions",
-               "status",
-               "--tenant", "public",
-               "--namespace", "default",
-               "--name", functionName
-       );
-
-       FunctionStatus functionStatus = FunctionStatusUtil.decode(result.getStdout());
-       assertEquals(functionStatus.getNumInstances(), 1);
-       assertEquals(functionStatus.getInstances().get(0).getStatus().isRunning(), true);
-   }
-
-
-   @Test(groups = {"java_function", "function"})
-   public void testJavaExclamationFunction() throws Exception {
-       testExclamationFunction(Runtime.JAVA, false, false, false);
-   }
-
-   @Test(groups = {"java_function", "function"})
-   public void testJavaExclamationTopicPatternFunction() throws Exception {
-       testExclamationFunction(Runtime.JAVA, true, false, false);
-   }
-
-   @Test(groups = {"java_function", "function"})
-   public void testJavaLoggingFunction() throws Exception {
-       testLoggingFunction(Runtime.JAVA);
-   }
-
-
-   @Test(groups = {"java_function", "function"})
-   public void testInitFunction() throws Exception {
-	   testInitFunction(Runtime.JAVA);
-   }
-
-   @Test(groups = {"java_function", "function"})
-   public void testTumblingCountWindowTest() throws Exception {
-       String[] EXPECTED_RESULTS = {
-               "0,1,2,3,4,5,6,7,8,9",
-               "10,11,12,13,14,15,16,17,18,19",
-               "20,21,22,23,24,25,26,27,28,29",
-               "30,31,32,33,34,35,36,37,38,39",
-               "40,41,42,43,44,45,46,47,48,49",
-               "50,51,52,53,54,55,56,57,58,59",
-               "60,61,62,63,64,65,66,67,68,69",
-               "70,71,72,73,74,75,76,77,78,79",
-               "80,81,82,83,84,85,86,87,88,89",
-               "90,91,92,93,94,95,96,97,98,99",
-       };
-
-       testWindowFunction("tumbling", EXPECTED_RESULTS);
-   }
-
-   @Test(groups = {"java_function", "function"})
-   public void testSlidingCountWindowTest() throws Exception {
-       String[] EXPECTED_RESULTS = {
-               "0,1,2,3,4",
-               "0,1,2,3,4,5,6,7,8,9",
-               "5,6,7,8,9,10,11,12,13,14",
-               "10,11,12,13,14,15,16,17,18,19",
-               "15,16,17,18,19,20,21,22,23,24",
-               "20,21,22,23,24,25,26,27,28,29",
-               "25,26,27,28,29,30,31,32,33,34",
-               "30,31,32,33,34,35,36,37,38,39",
-               "35,36,37,38,39,40,41,42,43,44",
-               "40,41,42,43,44,45,46,47,48,49",
-               "45,46,47,48,49,50,51,52,53,54",
-               "50,51,52,53,54,55,56,57,58,59",
-               "55,56,57,58,59,60,61,62,63,64",
-               "60,61,62,63,64,65,66,67,68,69",
-               "65,66,67,68,69,70,71,72,73,74",
-               "70,71,72,73,74,75,76,77,78,79",
-               "75,76,77,78,79,80,81,82,83,84",
-               "80,81,82,83,84,85,86,87,88,89",
-               "85,86,87,88,89,90,91,92,93,94",
-               "90,91,92,93,94,95,96,97,98,99",
-       };
-
-       testWindowFunction("sliding", EXPECTED_RESULTS);
-   }
+    @Test(groups = {"java_function", "function"})
+    public void testJavaFunctionNegAck() throws Exception {
+        testFunctionNegAck(Runtime.JAVA);
+    }
+
+    @Test(groups = {"java_function", "function"})
+    public void testJavaPublishFunction() throws Exception {
+        testPublishFunction(Runtime.JAVA);
+    }
+
+    @Test(groups = {"java_function", "function"})
+    public void testSerdeFunction() throws Exception {
+        testCustomSerdeFunction();
+    }
+
+    private void testCustomSerdeFunction() throws Exception {
+        if (functionRuntimeType == FunctionRuntimeType.THREAD) {
+            return;
+        }
+
+        String inputTopicName = "persistent://public/default/test-serde-java-input-" + randomName(8);
+        String outputTopicName = "test-publish-serde-output-" + randomName(8);
+        try (PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarCluster.getHttpServiceUrl()).build()) {
+            admin.topics().createNonPartitionedTopic(inputTopicName);
+            admin.topics().createNonPartitionedTopic(outputTopicName);
+        }
+
+        String functionName = "test-serde-fn-" + randomName(8);
+        submitFunction(
+                Runtime.JAVA, inputTopicName, outputTopicName, functionName, null, SERDE_JAVA_CLASS,
+                SERDE_OUTPUT_CLASS, Collections.singletonMap("serde-topic", outputTopicName)
+        );
+
+        // get function info
+        getFunctionInfoSuccess(functionName);
+        // get function stats
+        getFunctionStatsEmpty(functionName);
+
+        ContainerExecResult result = pulsarCluster.getAnyWorker().execCmd(
+                PulsarCluster.ADMIN_SCRIPT,
+                "functions",
+                "status",
+                "--tenant", "public",
+                "--namespace", "default",
+                "--name", functionName
+        );
+
+        FunctionStatus functionStatus = FunctionStatusUtil.decode(result.getStdout());
+        assertEquals(functionStatus.getNumInstances(), 1);
+        assertEquals(functionStatus.getInstances().get(0).getStatus().isRunning(), true);
+    }
+
+
+    @Test(groups = {"java_function", "function"})
+    public void testJavaExclamationFunction() throws Exception {
+        testExclamationFunction(Runtime.JAVA, false, false, false);
+    }
+
+    @Test(groups = {"java_function", "function"})
+    public void testJavaExclamationTopicPatternFunction() throws Exception {
+        testExclamationFunction(Runtime.JAVA, true, false, false);
+    }
+
+    @Test(groups = {"java_function", "function"})
+    public void testJavaLoggingFunction() throws Exception {
+        testLoggingFunction(Runtime.JAVA);
+    }
+
+
+    @Test(groups = {"java_function", "function"})
+    public void testInitFunction() throws Exception {
+        testInitFunction(Runtime.JAVA);
+    }
+
+    @Test(groups = {"java_function", "function"})
+    public void testTumblingCountWindowTest() throws Exception {
+        String[] EXPECTED_RESULTS = {
+                "0,1,2,3,4,5,6,7,8,9",
+                "10,11,12,13,14,15,16,17,18,19",
+                "20,21,22,23,24,25,26,27,28,29",
+                "30,31,32,33,34,35,36,37,38,39",
+                "40,41,42,43,44,45,46,47,48,49",
+                "50,51,52,53,54,55,56,57,58,59",
+                "60,61,62,63,64,65,66,67,68,69",
+                "70,71,72,73,74,75,76,77,78,79",
+                "80,81,82,83,84,85,86,87,88,89",
+                "90,91,92,93,94,95,96,97,98,99",
+        };
+
+        testWindowFunction("tumbling", EXPECTED_RESULTS);
+    }
+
+    @Test(groups = {"java_function", "function"})
+    public void testSlidingCountWindowTest() throws Exception {
+        String[] EXPECTED_RESULTS = {
+                "0,1,2,3,4",
+                "0,1,2,3,4,5,6,7,8,9",
+                "5,6,7,8,9,10,11,12,13,14",
+                "10,11,12,13,14,15,16,17,18,19",
+                "15,16,17,18,19,20,21,22,23,24",
+                "20,21,22,23,24,25,26,27,28,29",
+                "25,26,27,28,29,30,31,32,33,34",
+                "30,31,32,33,34,35,36,37,38,39",
+                "35,36,37,38,39,40,41,42,43,44",
+                "40,41,42,43,44,45,46,47,48,49",
+                "45,46,47,48,49,50,51,52,53,54",
+                "50,51,52,53,54,55,56,57,58,59",
+                "55,56,57,58,59,60,61,62,63,64",
+                "60,61,62,63,64,65,66,67,68,69",
+                "65,66,67,68,69,70,71,72,73,74",
+                "70,71,72,73,74,75,76,77,78,79",
+                "75,76,77,78,79,80,81,82,83,84",
+                "80,81,82,83,84,85,86,87,88,89",
+                "85,86,87,88,89,90,91,92,93,94",
+                "90,91,92,93,94,95,96,97,98,99",
+        };
+
+        testWindowFunction("sliding", EXPECTED_RESULTS);
+    }
 
     @Test(groups = {"java_function", "function"})
     public void testMergeFunctionTest() throws Exception {
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaThreadTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaThreadTest.java
index 60bd520a6bc..ee8c8c60c98 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaThreadTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarFunctionsJavaThreadTest.java
@@ -22,7 +22,7 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarFunctionsJavaThreadTest extends PulsarFunctionsJavaTest {
 
-	public PulsarFunctionsJavaThreadTest() {
-		super(FunctionRuntimeType.THREAD);
-	}
+    public PulsarFunctionsJavaThreadTest() {
+        super(FunctionRuntimeType.THREAD);
+    }
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainProcessTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainProcessTest.java
index f86857587c3..75740b0a15a 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainProcessTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainProcessTest.java
@@ -22,7 +22,7 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarWorkerRebalanceDrainProcessTest extends PulsarWorkerRebalanceDrainTest {
 
-	public PulsarWorkerRebalanceDrainProcessTest() {
-		super(FunctionRuntimeType.PROCESS);
-	}
+    public PulsarWorkerRebalanceDrainProcessTest() {
+        super(FunctionRuntimeType.PROCESS);
+    }
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainThreadTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainThreadTest.java
index 2dae5863a8d..031c8669efb 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainThreadTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/java/PulsarWorkerRebalanceDrainThreadTest.java
@@ -22,7 +22,7 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarWorkerRebalanceDrainThreadTest extends PulsarWorkerRebalanceDrainTest {
 
-	public PulsarWorkerRebalanceDrainThreadTest() {
-		super(FunctionRuntimeType.THREAD);
-	}
+    public PulsarWorkerRebalanceDrainThreadTest() {
+        super(FunctionRuntimeType.THREAD);
+    }
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonProcessTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonProcessTest.java
index aff9df59709..82526d3b552 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonProcessTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonProcessTest.java
@@ -22,7 +22,7 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarFunctionsPythonProcessTest extends PulsarFunctionsPythonTest {
 
-	public PulsarFunctionsPythonProcessTest() {
-		super(FunctionRuntimeType.PROCESS);
-	}
+    public PulsarFunctionsPythonProcessTest() {
+        super(FunctionRuntimeType.PROCESS);
+    }
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonThreadTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonThreadTest.java
index 9f28a136cd0..c25be1de8aa 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonThreadTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/python/PulsarFunctionsPythonThreadTest.java
@@ -22,7 +22,7 @@ import org.apache.pulsar.tests.integration.topologies.FunctionRuntimeType;
 
 public class PulsarFunctionsPythonThreadTest extends PulsarFunctionsPythonTest {
 
-  public PulsarFunctionsPythonThreadTest() {
+    public PulsarFunctionsPythonThreadTest() {
 	super(FunctionRuntimeType.THREAD);
   }
 }