How can I add region endpoints to pub sub emulator

254 Views Asked by At

I am testing pub sub region failure.

So I only need one region topic up. And if I ping the same topic with another endpoint , it should fail. I am testing with emulator. But in emulator there is no way to add regional endpoints. How can I test this then ?

I am testing a scenario where I can check if one region is down , I can send the message to the other region.

1

There are 1 best solutions below

0
On

This is not a scenario that the emulator is designed to test. Communicating with the emulator requires one to change the address one contacts to be the address of the emulator. Some client libraries do this internally when the emulator environment variable is set.

Even if it did allow you to specify regional endpoints, it wouldn't have a way to selectively reject requests that come in on one address and not the other.

I'm not sure this is the kind of scenario that requires the emulator as those tests are really designed to ensure proper behavior given the way the Pub/Sub service itself works. In this case, you need only test that the reaction to RPC failures is as expected, so you could fake error responses using libraries designed for such things in the language you are using and ensure that you then send requests to a different region when those initial failures are returned.