cjab/weddell

Support for local gcloud PubSub emulator

Closed this issue · 5 comments

I want to be able to use Weddell to develop against a local pubsub emulator instance started like so: gcloud beta emulators pubsub start --project=my-project

This will require a Goth bypass or mock. Do you know where the PubSub and Goth specs are so I can reference them while I make my PR?

cjab commented

Hi there @medikent . If you want to see an example of how the emulator might be used in a test take a look at the integration test case (test/support/integration_case.ex) and the integration tests themselves at test/weddell_test.ex and test/weddell/consumer_test.exs.

As far as using the emulator from your own application you should be able to point weddell at your emulator in your configuration:

config :weddell,
 project: "gcp-project-name",
 scheme: "http",
 host: "localhost",
 port: 8085
config :goth,
 json: {:system, "GCP_CREDENTIALS_JSON"}

I believe the emulator will accept any credentials or none at all.

config :goth, disabled: true

I hope this helps!

Yes, I am able to use things locally now.
I am getting a Bad GCP Credentials error in "lib/weddell/client.ex" though.

cjab commented

@medikent If this is using config :goth, disabled: true it shouldn't cause a problem for the emulator. It's just a warning letting you know your credentials aren't valid and so they won't be added to request headers. The connection to the real service would fail after the warning. You should be able to get rid of the warning by using real gcp credentials when configuring goth.

The warning was causing a high volume of log output which is fixed by PR #9

@cjab your solution works great locally. We can close this issue.