scwhittle commented on code in PR #23333:
URL: https://github.com/apache/beam/pull/23333#discussion_r998381013


##########
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorkerTest.java:
##########
@@ -3081,6 +3146,283 @@ public void testActiveWorkRefresh() throws Exception {
     assertThat(server.numGetDataRequests(), greaterThan(0));
   }
 
+  static class FakeClock implements Supplier<Instant> {
+    private static final FakeClock DEFAULT = new FakeClock();

Review Comment:
   Hmm I forgot it actually serialized/deserialized, I thought we were just 
passing the DoFn directly.
   I think you could make the clock serializable but if you did the 
deserialized clock would be a different instance than the one injected by the 
test. 
   
   Another option would be to have a static method on the SlowDoFn that allows 
setting a static Clock field that all instances use.  Then each test could set 
this to it's local FakeClock.  That seems a little nicer than a static default 
clock since it can be cleared/reset between tests to avoid potential leakage.



-- 
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