Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VAULT-15395: Support mocking time functions in the activity log #20720

Merged
merged 5 commits into from
May 23, 2023

Conversation

miagilepner
Copy link
Contributor

@miagilepner miagilepner commented May 23, 2023

This PR adds an exported interface to the timeutil package called Clock, which can be used to mock the standard lib time functions.

I've used the interface in the activity log, so that tests can configure mocked time functions. I added a test that uses this functionality to mock the end of a month.

@miagilepner miagilepner added this to the 1.14 milestone May 23, 2023
@miagilepner miagilepner marked this pull request as ready for review May 23, 2023 13:30
Copy link
Contributor

@mpalmi mpalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just comment that needs to be updated, but approving anyway.

vault/activity_log_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@hghaf099 hghaf099 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just posted a few questions.

vault/activity_log.go Outdated Show resolved Hide resolved
vault/activity_log.go Show resolved Hide resolved
helper/timeutil/timeutil.go Show resolved Hide resolved
vault/activity_log_test.go Show resolved Hide resolved
vault/activity_log_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@hghaf099 hghaf099 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants