Ability to start bigtable-emulator on fixed port-number #1192
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.
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).
The text was updated successfully, but these errors were encountered: