Open kayleg opened 4 years ago
happy to do it, should have done this part of my pr sorry :-)
Yeah, that would be nice. I assume that requires a fake service account? I have an issue running ci tests currently, so I'm guessing I'll need this too
I'm curious how this should be done as cloud_pubsub does seem to expect a service account, which means I'll need to create a fake one, right?
@ruseinov The package does so I'm guessing you would need one from that aspect. But I've never used the emulator so not sure if it actually needs to be a valid one or if the emulator can create a fake one for emulator purpose only.
Actually I don't know, I just know that the crate won't work without a somewhat valid service account. I'll check it out.
@kayleg it looks like the official libraries are happy without any credentials: https://cloud.google.com/pubsub/docs/emulator . I guess we need a way to construct the client without credentials and look at the env variables (project_id, emulator_host) to decide whether to fail or not. We could make the credentials Optional and the make this decision based on whether the Option is Some or None + the existence of environment variables.
Hey folks, any updates on the documentation on how to use the Emulator ?
I was supposed to do it but have been caught up on other things, anything that isn't working for you?
https://cloud.google.com/pubsub/docs/emulator was good enough for me to get going with it. I kept passing the same credentials and everything worked.
The only thing that surprised me at first was that I had to recreate subscriptions every time I would restart the emulator and was using the pythons scripts provided from the linked documentation.
@ruseinov An idea would be to create a dummy service account that has access to nothing on GCP. That way in your tests, virtually nothing changes but having the emulator host env var and reading from the dummy service account (which can also be injected via an env var).
@sync do you just set the project id and the emulator host as env vars and the lib knows what to do on it's own ?
I run $(gcloud beta emulators pubsub env-init)
in the same terminal where I run cargo
@sync awesome. I typically use docker-compose up -d
in development. There I have a pubsub emulator running.
cool on OS X docker is always slow sadly I would if on Linux
@IMFIL thanks for sharing the docker compose docker image, I was just looking for one!
https://cloud.google.com/sdk/gcloud/reference/beta/emulators/pubsub