Skip to content

Testing with time #589

@andrew-su

Description

@andrew-su

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions