kubernetes-sigs / gateway-api

Repository for the next iteration of composite service (e.g. Ingress) and load balancing APIs.
https://gateway-api.sigs.k8s.io
Apache License 2.0
1.67k stars 437 forks source link

[conformance] Properly handle lifecycle of an externally passed gRPC client #3156

Open gauravkghildiyal opened 2 weeks ago

gauravkghildiyal commented 2 weeks ago

What would you like to be added: This issue is for tracking the changes discussed in https://github.com/kubernetes-sigs/gateway-api/pull/3130#discussion_r1635872850... tl;dr being that MakeRequestAndExpectEventuallyConsistentResponse() should not close an externally passed gRPC client.

Why this is needed: The same client could be getting used across multiple tests in parallel. Closing the client should be the responsibility of the place where it was created (and not necessarily within the place where the client gets used)

/cc @snehachhabria

mikemorris commented 1 week ago

Makes sense to me - would this change just be moving the defer c.Close() one line up to within the if c == nil conditional and adding a test to confirm it doesn't get closed when a non-nil connection is passed in?

Is there a parallel concern for the HTTP helper too? I'd expect these should have consistent behavior.

/assign