Skip to content

Commit 5acd3dc

Browse files
mutianfandre-sampaiocloud-java-bot
authored
feat: add port as a parameter for the bigtable emulator (#2645)
* feat: add port as a parameter for the bigtable emulator * chore: generate libraries at Wed Jul 16 21:29:57 UTC 2025 * set the port in emulator class --------- Co-authored-by: André Barbosa Sampaio <[email protected]> Co-authored-by: cloud-java-bot <[email protected]>
1 parent 717bc85 commit 5acd3dc

File tree

2 files changed

+14
-2
lines changed
  • google-cloud-bigtable-emulator-core/src/main/java/com/google/cloud/bigtable/emulator/core
  • google-cloud-bigtable-emulator/src/main/java/com/google/cloud/bigtable/emulator/v2

2 files changed

+14
-2
lines changed

google-cloud-bigtable-emulator-core/src/main/java/com/google/cloud/bigtable/emulator/core/EmulatorController.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ public synchronized boolean isRunning() {
9393
}
9494

9595
/** Starts the emulator process and waits for it to be ready. */
96-
public synchronized void start() throws IOException, TimeoutException, InterruptedException {
96+
public synchronized void start(int port)
97+
throws IOException, TimeoutException, InterruptedException {
9798
if (!isStopped) {
9899
throw new IllegalStateException("Emulator is already started");
99100
}
100-
this.port = getAvailablePort();
101+
102+
this.port = port;
101103

102104
// Try to align the localhost address across java & golang emulator
103105
// This should fix issues on systems that default to ipv4 but the jvm is started with
@@ -143,6 +145,11 @@ public synchronized void start() throws IOException, TimeoutException, Interrupt
143145
waitForPort(port);
144146
}
145147

148+
/** Starts the emulator process and waits for it to be ready. */
149+
public synchronized void start() throws IOException, TimeoutException, InterruptedException {
150+
start(getAvailablePort());
151+
}
152+
146153
/** Stops the emulator process. */
147154
public synchronized void stop() {
148155
if (isStopped) {

google-cloud-bigtable-emulator/src/main/java/com/google/cloud/bigtable/emulator/v2/Emulator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public synchronized void start() throws IOException, TimeoutException, Interrupt
6262
controller.start();
6363
}
6464

65+
public synchronized void start(int port)
66+
throws IOException, TimeoutException, InterruptedException {
67+
controller.start(port);
68+
}
69+
6570
/** Stops the emulator process. */
6671
public synchronized void stop() {
6772
controller.stop();

0 commit comments

Comments
 (0)