We have a reconciler which does some heavy processing and may take a lot of time. After it completes its tasks we want to stamp out the completion time + 5 minutes in the status for example.
During tests, this happens quick but still it's off by a few nanoseconds which we can fix by using the provided time package and setting Now in the tests. However this means we need to switch from using regular time package to the one provided by RR. This is a problem because it won't be accurate to when the task completed + 5m during a real reconcile. I see that the ResourceReconciler stashes the current time at the beginning of the reconcile.
|
ctx = rtime.StashNow(ctx, time.Now()) |
Maybe for time testing a way to provide more gocmp options (approximating time) or to have a way to disable the auto now time stashing for ResourceReconciler.
Do you have another idea on steps to work around this?
We have a reconciler which does some heavy processing and may take a lot of time. After it completes its tasks we want to stamp out the completion time + 5 minutes in the status for example.
During tests, this happens quick but still it's off by a few nanoseconds which we can fix by using the provided time package and setting
Nowin the tests. However this means we need to switch from using regular time package to the one provided by RR. This is a problem because it won't be accurate to when the task completed + 5m during a real reconcile. I see that theResourceReconcilerstashes the current time at the beginning of the reconcile.runtime/reconcilers/resource.go
Line 233 in df0175b
Maybe for time testing a way to provide more gocmp options (approximating time) or to have a way to disable the auto now time stashing for ResourceReconciler.
Do you have another idea on steps to work around this?