Replies: 4 comments 1 reply
-
One way to achieve this would be a configuration outside of our application by using something like https://github.com/wolfcw/libfaketime If we want to to go this way we would have to create a more extensive test setup outside of the application and test code. I did not think this through too much - it is not trivial and controlling it from the test might be even harder (i.e. not only setting it to one specific time before running one test, but manipulating the current time from within the test, which would could be very useful to have). |
Beta Was this translation helpful? Give feedback.
-
We could add a Challenges around this are related to using such a |
Beta Was this translation helpful? Give feedback.
-
I haven't looked into these solutions, but ages ago I created a PR for itchysats that did exactly what we want - will try to dig it up for evaluation. |
Beta Was this translation helpful? Give feedback.
-
https://blog.iany.me/2019/03/how-to-mock-time-in-rust-tests-and-cargo-gotchas-we-met/ describes various challanges. They have tried to configure conditions using They recommend using |
Beta Was this translation helpful? Give feedback.
-
As mentioned #2282 we might want to add restrictions to allowing a
settlement_event_id
for rollover. This would mean that our actor tests start depending on the current time, which is not a trivial problem to solve.The proper way to achieve stable tests would be to make time deterministic (that way we could also test edge cases). This would mean that we would have to define a test setup (or over application setup) that makes it possible to control time (i.e. calls to
now
).One problem to solve here, is that the "controlled" time would have to be globally available to the system. We can write unit tests where we supply
now
(as done inmodel::cfd
) but in the actor tests we would have to control the time at an application level.Beta Was this translation helpful? Give feedback.
All reactions