Skip to content

Commit

Permalink
Prevent unit tests and E2E from using host ports 7181 and 9000
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Jul 27, 2024
1 parent 9bceb88 commit e755c04
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

class OneOffJobBootstrapTest {

private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(7181);
private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(-1);

private static final ZookeeperConfiguration ZOOKEEPER_CONFIGURATION = new ZookeeperConfiguration(EMBED_TESTING_SERVER.getConnectionString(), OneOffJobBootstrapTest.class.getSimpleName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
@ExtendWith(MockitoExtension.class)
class JobOperateAPIImplTest {

static final int DUMP_PORT = 9000;

private JobOperateAPI jobOperateAPI;

// TODO We should not use `Mock.Strictness.LENIENT` here, but the default. This is a flaw in the unit test design.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@Getter(AccessLevel.PROTECTED)
public abstract class BaseAnnotationE2ETest {

private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(7181);
private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(-1);

private static final ZookeeperConfiguration ZOOKEEPER_CONFIG = new ZookeeperConfiguration(EMBED_TESTING_SERVER.getConnectionString(), "zkRegTestCenter");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Getter(AccessLevel.PROTECTED)
public abstract class BaseE2ETest {

private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(7181);
private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(-1);

private static final ZookeeperConfiguration ZOOKEEPER_CONFIG = new ZookeeperConfiguration(EMBED_TESTING_SERVER.getConnectionString(), "zkRegTestCenter");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

public abstract class BaseSnapshotServiceE2ETest {

static final int DUMP_PORT = 9000;
static final int DUMP_PORT = -1;

private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(7181);
private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(-1);

private static final ZookeeperConfiguration ZOOKEEPER_CONFIG = new ZookeeperConfiguration(EMBED_TESTING_SERVER.getConnectionString(), "zkRegTestCenter");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,6 @@ private boolean isIgnoredException(final Throwable cause) {
* @return connection string
*/
public String getConnectionString() {
return "localhost:" + port;
return testingServer.getConnectString();
}
}

0 comments on commit e755c04

Please sign in to comment.