Skip to content

Commit

Permalink
GEODE-6372: use random port when starting server to avoid port confli…
Browse files Browse the repository at this point in the history
…ct (apache#3237)
  • Loading branch information
jinmeiliao authored Feb 26, 2019
1 parent 4a84f6c commit 53f5538
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void deployLargeSetOfJars() throws Exception {
String commonLibs = Arrays.stream(libDir.listFiles(x -> x.getName().startsWith("commons")))
.map(File::getAbsolutePath).collect(Collectors.joining(","));
GfshExecution execution = GfshScript.of("start locator --name=locator --max-heap=128m",
"start server --name=server --max-heap=128m", "sleep --time=1",
"start server --name=server --max-heap=128m --server-port=0", "sleep --time=1",
"deploy --jars=" + commonLibs).execute(gfsh);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class DestroyIndexIfExistsTest {
@Test
public void destroyIndexIfExists() throws Exception {
GfshExecution execution =
GfshScript.of("start locator --name=locator", "start server --name=server",
GfshScript.of("start locator --name=locator", "start server --name=server --server-port=0",
"sleep --time=1", "destroy index --name=i1 --if-exists=true").execute(gfsh);

assertThat(execution.getOutputText()).contains("IGNORED", "Index named \"i1\" not found");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class ImportClusterConfigTest extends ClusterConfigTestBase {
@Test
public void importWouldNotShutDownServer() {
GfshExecution startCluster = GfshScript
.of("start locator --name=" + locatorName, "start server --name=" + serverNotShutDownName)
.of("start locator --name=" + locatorName,
"start server --name=" + serverNotShutDownName + " --server-port=0")
.withName("startCluster").execute(gfsh);
assertThat(startCluster.getOutputText()).contains(locatorName + " is currently online")
.contains(serverNotShutDownName + " is currently online");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class StopServerAcceptanceTest {

@Before
public void startCluster() {
gfshRule.execute("start locator --name=locator", "start server --name=server");
gfshRule.execute("start locator --name=locator", "start server --name=server --server-port=0");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ private GfshExecution startCluster() {
.addOption("security-properties-file", securityPropertiesFile.getAbsolutePath()).toString();

String startServer = new CommandStringBuilder("start server").addOption("name", "server")
.addOption("server-port", "0")
.addOption("security-properties-file", securityPropertiesFile.getAbsolutePath()).toString();

return GfshScript.of(startLocator, startServer).withName("cluster-setup").execute(gfshRule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ private static String startLocatorCommand() {
}

private static String startServerCommand() {
return new CommandStringBuilder("start server").addOption("name", serverName).toString();
return new CommandStringBuilder("start server")
.addOption("server-port", "0")
.addOption("name", serverName).toString();
}

private String statusServerCommandByName() {
Expand Down

0 comments on commit 53f5538

Please sign in to comment.