I have unidirectional (both client- and server-) streaming gRPC methods implemented in my golang server. I came across bufconn
which enables me to creates my server via in-memory connections in my tests. However, I have logic in my method where I check the peer's address, it always returns "bufconn". I do rely on the peer to provide the IP address along with its port, but I can't really achieve that using bufconn.
- What is a canonical (or preferred) way to test gRPC streaming calls in golang?
- Is it considered an anti-pattern to rely on peer information in the context?