lostluck commented on pull request #16816:
URL: https://github.com/apache/beam/pull/16816#issuecomment-1035626538


   > Agree the mocking there isn't the right move. While one _can_ use 
unexported package level variables and override them with test specific 
options, they are still in a "global" namespace and can be brittle.
   > 
   > The right way to do that kind of mocking would be to pass in the thing 
being mocked into an unexported function to be called. Then the test 
implementation just calls the same function, passing in the test implementation.
   > 
   > Note that the "thing to be mocked" can be an interface, or an arbitrary 
configuration struct, so it doesn't necessarily end up as 1 new parameter per 
thing to be mocked.
   
   Let me know if you want to do the "refactor the make this more testable" 
approach, and if not, I'll merge this in as is.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to