Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ private void testExclamationFunction(Runtime runtime,
}

// get function status
getFunctionStatus(functionName, numMessages);
getFunctionStatus(functionName, numMessages, true);

// get function stats
getFunctionStats(functionName, numMessages);
Expand Down Expand Up @@ -964,7 +964,7 @@ private static void checkSubscriptionsCleanup(String topic) throws Exception {
}
}

private static void getFunctionStatus(String functionName, int numMessages) throws Exception {
private static void getFunctionStatus(String functionName, int numMessages, boolean checkRestarts) throws Exception {
ContainerExecResult result = pulsarCluster.getAnyWorker().execCmd(
PulsarCluster.ADMIN_SCRIPT,
"functions",
Expand All @@ -985,7 +985,9 @@ private static void getFunctionStatus(String functionName, int numMessages) thro
assertTrue(functionStatus.getInstances().get(0).getStatus().getLastInvocationTime() > 0);
assertEquals(functionStatus.getInstances().get(0).getStatus().getNumReceived(), numMessages);
assertEquals(functionStatus.getInstances().get(0).getStatus().getNumSuccessfullyProcessed(), numMessages);
assertEquals(functionStatus.getInstances().get(0).getStatus().getNumRestarts(), 0);
if (checkRestarts) {
assertEquals(functionStatus.getInstances().get(0).getStatus().getNumRestarts(), 0);
}
assertEquals(functionStatus.getInstances().get(0).getStatus().getLatestUserExceptions().size(), 0);
assertEquals(functionStatus.getInstances().get(0).getStatus().getLatestSystemExceptions().size(), 0);
}
Expand Down Expand Up @@ -1121,8 +1123,9 @@ public void testAutoSchemaFunction() throws Exception {
// publish and consume result
publishAndConsumeAvroMessages(inputTopicName, outputTopicName, numMessages);

// get function status
getFunctionStatus(functionName, numMessages);
// get function status. Note that this function might restart a few times until
// the producer above writes the messages.
getFunctionStatus(functionName, numMessages, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why will this restart a couple of times? That doesn't sound like the correct behavior


// delete function
deleteFunction(functionName);
Expand Down