Skip to content

Commit

Permalink
[fix][test] Stop worker services when tearing down PulsarFunctionTlsT…
Browse files Browse the repository at this point in the history
…est. (apache#17054)
  • Loading branch information
RobertIndie authored Aug 11, 2022
1 parent ba44883 commit 6ae2876
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class PulsarFunctionTlsTest {
protected PulsarService[] pulsarServices = new PulsarService[BROKER_COUNT];
protected PulsarService leaderPulsar;
protected PulsarAdmin leaderAdmin;
protected WorkerService[] fnWorkerServices = new WorkerService[BROKER_COUNT];
protected String testCluster = "my-cluster";
protected String testTenant = "my-tenant";
protected String testNamespace = testTenant + "/my-ns";
Expand Down Expand Up @@ -137,12 +138,12 @@ void setup() throws Exception {
workerConfig.setBrokerClientAuthenticationEnabled(true);
workerConfig.setTlsEnabled(true);
workerConfig.setUseTls(true);
WorkerService fnWorkerService = WorkerServiceLoader.load(workerConfig);
fnWorkerServices[i] = WorkerServiceLoader.load(workerConfig);

configurations[i] = config;

pulsarServices[i] = new PulsarService(
config, workerConfig, Optional.of(fnWorkerService), code -> {});
config, workerConfig, Optional.of(fnWorkerServices[i]), code -> {});
pulsarServices[i].start();

// Sleep until pulsarServices[0] becomes leader, this way we can spy namespace bundle assignment easily.
Expand Down Expand Up @@ -181,6 +182,9 @@ void tearDown() throws Exception {
if (pulsarAdmins[i] != null) {
pulsarAdmins[i].close();
}
if (fnWorkerServices[i] != null) {
fnWorkerServices[i].stop();
}
if (pulsarServices[i] != null) {
pulsarServices[i].close();
}
Expand Down

0 comments on commit 6ae2876

Please sign in to comment.