https://pantsbuild.org/ logo
#development
Title
# development
f

fast-nail-55400

06/02/2020, 7:46 PM
is there a rust crate for controlling clock in tests?
1
w

witty-crayon-22786

06/02/2020, 7:49 PM
i think it would need to be executor specific
so either tokio (if that’s what is delaying) or the gRPC stack… which is using the underlying grpc c library
f

fast-nail-55400

06/02/2020, 7:51 PM
I’ll open an issue. As I write the RE streaming PR, the tests that test time outs occurring seem brittle.
w

witty-crayon-22786

06/02/2020, 7:51 PM
so, some of them probably stems from a difference in opinions on test timeouts
i try to differentiate “positive” timeouts (the time you wait for something that you want to happen to happen) from “negative” timeouts (the time you wait for something that you don’t want to happen)
f

fast-nail-55400

06/02/2020, 7:53 PM
In this case, these are time outs in the actual RE client and the test is testing that the RE client times out.
w

witty-crayon-22786

06/02/2020, 7:54 PM
positive timeouts should be set very long (and should not be sleeps … should be based on polling or events)
f

fast-nail-55400

06/02/2020, 7:54 PM
If this was Ruby, I’d use Timecop and would have the test advance time when it wanted to force the time out.
w

witty-crayon-22786

06/02/2020, 7:54 PM
right, so that’s a positive timeout.
yea. i haven’t seen one of those libraries work well with async code. but if it were integrated with the executor it might work.
f

fast-nail-55400

06/02/2020, 8:06 PM