pubsub/pstest: add support to register other servers into the grpc.Server #9198
Labels
api: pubsub
Issues related to the Pub/Sub API.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Is your feature request related to a problem? Please describe.
I'd like to use
GetPolicy()
andSetPolicy()
in the tests that rely on thepstest.Server
. For this, I would need to register myFakeIAMPolicyServer
into thegrpc.Server
instance. Currently the instance is hidden behind unexposed variables.Describe the solution you'd like
I would like to add new method with callback function to initialise the
pstest.Server
:The existing
NewServer
andNewServerWithPort
would use internally empty callback for backwards compatiblity.The server registration process would change like this:
The new method would be used for example like this:
Describe alternatives you've considered
The
srv
in thepstest.Server
could be exposed. But then we would need new method that creates new server without calling thesrv.Start()
. Registering additional fakes is only possible before theGsrv.Serve()
is called.The text was updated successfully, but these errors were encountered: