Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to start bigtable-emulator on fixed port-number #1192

Open
rameshj28787 opened this issue Mar 4, 2022 · 1 comment
Open

Ability to start bigtable-emulator on fixed port-number #1192

rameshj28787 opened this issue Mar 4, 2022 · 1 comment
Labels
api: bigtable Issues related to the googleapis/java-bigtable API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@rameshj28787
Copy link

rameshj28787 commented Mar 4, 2022

com.google.cloud.bigtable.emulator.v2.Emulator creates the bigtable-emulator in random port-numbers.

Having the port-number generated after test suite starts execution makes it troublesome to use bigtable-emulator for testing application code.

Because now, we need to dynamically setup BIGTABLE_EMULATOR_HOST environment variable to make application-code connect to emulator.

Dynamically updating environment variables is not an easy task and not supported by most frameworks (Springboot, Microanut included). There may be external libraries like System Rules, System Lambda etc. to dynamically update environment variables.
Reference Link. But they could often be not easy to use or reliable.

Hence, To use bigtable-emulator for unit-testing or integration testing application code, it will be very helpful & convenient, if we can start bigtable-emulator on a predefined fixed port-number. (that way we can setup BIGTABLE_EMULATOR_HOST environment variable in Maven/Gradle configurations)

com.google.cloud.bigtable.emulator.v2.Emulator could support creating emulator instances with a predefined port-number

Currently, the workaround I am using to define a custom FixedPortEmulator class in application testing code that takes and uses port number from BIGTABLE_EMULATOR_HOST environment variable. But this involves code duplication of entire Emulator class(not a good practice).

@product-auto-label product-auto-label bot added the api: bigtable Issues related to the googleapis/java-bigtable API. label Mar 4, 2022
@kolea2 kolea2 added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 4, 2022
@rameshj28787
Copy link
Author

Pull request: #1193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/java-bigtable API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants