Local testing permissions (IAM) for GCP Pub/Sub topic

39 views
Skip to first unread message

jitesh khuttan

unread,
Jan 19, 2022, 10:38:12 AM1/19/22
to pubsub-discuss
Hey guys!

I have a use case where I want to test the permissions (IAM) locally for GCP Pub/Sub topic. There is a sample code that official document provides.

I am trying to test my application locally using pub/sub emulator but it has some limitations (doesn't implement permissions).

As a solution, I have implemented a Fake pub/sub permission checker (flask server) - which would behave similar to real pub/sub IAM permission logic. I want my PublisherClient to connect with this fake server instead of pub/sub-emulator (or) real google pub/sub.

For ex: when you set PUBSUB_EMULATOR_HOST environment variable, below code would connect you to pub/sub emulator instead of real google pub/sub.

from google.cloud.pubsub_v1 import PublisherClient 
publisher = PublisherClient()

I would want my code to connect with my fake server when I write same above code. Is it possible to configure this?

Would really appreciate the help!

Efim (Cloud Platform Support)

unread,
Jan 22, 2022, 2:11:54 PM1/22/22
to pubsub-discuss
I searched for either on premises Cloud Pub/Sub server, or connecting to a third-party server without success.

Therefore, I created [this feature request](https://issuetracker.google.com/215878712). Please use it for further communication on the subject. 

Kindly note though, that at the moment there is no time estimate for the feature's implementation.
Reply all
Reply to author
Forward
0 new messages