Skip to content

Commit

Permalink
[pulsar function] set exposePulsarAdmin to true if enabled (#11417)
Browse files Browse the repository at this point in the history
Fixes #11416

### Verifying this change

- [ ] Make sure that the change passes the CI checks.

(cherry picked from commit 56722b8)
  • Loading branch information
nlu90 authored and codelipenghui committed Jul 30, 2021
1 parent 609a586 commit cb7e29f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ public static List<String> getCmd(InstanceConfig instanceConfig,
if (instanceConfig.isExposePulsarAdminClientEnabled() && StringUtils.isNotBlank(pulsarWebServiceUrl)) {
args.add("--web_serviceurl");
args.add(pulsarWebServiceUrl);
args.add("--expose_pulsaradmin");
}
}
if (authConfig != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ private void verifyJavaInstance(InstanceConfig config, String depsDir, boolean s
totalArgs += 4;
}
if (config.isExposePulsarAdminClientEnabled()) {
totalArgs += 2;
portArg += 2;
metricsPortArg += 2;
totalArgs += 3;
portArg += 3;
metricsPortArg += 3;
}

if (StringUtils.isNotEmpty(downloadDirectory)){
Expand All @@ -419,7 +419,8 @@ private void verifyJavaInstance(InstanceConfig config, String depsDir, boolean s
assertEquals(args.size(), totalArgs,
"Actual args : " + StringUtils.join(args, " "));

String pulsarAdminArg = config.isExposePulsarAdminClientEnabled() ? " --web_serviceurl " + pulsarAdminUrl : "";
String pulsarAdminArg = config.isExposePulsarAdminClientEnabled() ?
" --web_serviceurl " + pulsarAdminUrl + " --expose_pulsaradmin": "";

String expectedArgs = "exec java -cp " + classpath
+ extraDepsEnv
Expand All @@ -445,7 +446,6 @@ private void verifyJavaInstance(InstanceConfig config, String depsDir, boolean s
}
expectedArgs += " --cluster_name standalone --nar_extraction_directory " + narExtractionDirectory;

assertEquals(String.join(" ", args), expectedArgs);

// check padding and xmx
long heap = Long.parseLong(args.stream().filter(s -> s.startsWith("-Xmx")).collect(Collectors.toList()).get(0).replace("-Xmx", ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private void verifyJavaInstance(InstanceConfig config, Path depsDir, String webS
int metricsPortArg;
int totalArgCount = 41;
if (webServiceUrl != null && config.isExposePulsarAdminClientEnabled()) {
totalArgCount += 2;
totalArgCount += 3;
}
if (null != depsDir) {
assertEquals(args.size(), totalArgCount);
Expand All @@ -315,12 +315,12 @@ private void verifyJavaInstance(InstanceConfig config, Path depsDir, String webS
metricsPortArg = 25;
}
if (webServiceUrl != null && config.isExposePulsarAdminClientEnabled()) {
portArg += 2;
metricsPortArg += 2;
portArg += 3;
metricsPortArg += 3;
}

String pulsarAdminArg = webServiceUrl != null && config.isExposePulsarAdminClientEnabled() ?
" --web_serviceurl " + webServiceUrl : "";
" --web_serviceurl " + webServiceUrl + " --expose_pulsaradmin" : "";

String expectedArgs = "java -cp " + classpath
+ extraDepsEnv
Expand Down

0 comments on commit cb7e29f

Please sign in to comment.