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

fix(timecop gem): add support for Timecop 0.9.9 so that we could track proper tests' execution time when Process.clock_gettime is mocked #262

Merged
merged 8 commits into from
Jun 19, 2024

Conversation

ArturT
Copy link
Member

@ArturT ArturT commented Jun 18, 2024

Story

link to the internal story

Related

Changes introduced by Timecop 0.9.9:

Process.clock_gettime is mocked.

Timecop 0.9.10 makes Process.clock_gettime optionally mocked. The default is Timecop.mock_process_clock = false.

Our old PRs related to time tracking and mocking time:

Description

Add support for Timecop 0.9.9 so that we could track proper tests' execution time when Process.clock_gettime is mocked.

Changes

  • Knapsack Pro ignores the Process.clock_gettime mocked by the Timecop gem.

Checklist reminder

  • You added the changes to the UNRELEASED section of the CHANGELOG.md, including the needed bump (ie, patch, minor, major)
  • You follow the architecture outlined below for RSpec in Queue Mode, which is a work in progress (feel free to propose changes):
    • Pure: lib/knapsack_pro/pure/queue/rspec_pure.rb contains pure functions that are unit tested.
    • Extension: lib/knapsack_pro/extensions/rspec_extension.rb encapsulates calls to RSpec internals and is integration and e2e tested.
    • Runner: lib/knapsack_pro/runners/queue/rspec_runner.rb invokes the pure code and the extension to produce side effects, which are integration and e2e tested.

…k proper tests' execution time when Process.clock_gettime is mocked
@ArturT ArturT added the bug label Jun 18, 2024
@@ -5,5 +5,13 @@ class Utils
def self.unsymbolize(obj)
JSON.parse(obj.to_json)
end

def self.now
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a personal opinion more than anything else - I'm not convinced Utils.now makes it clear that it returns the current time, maybe time_now? But feel free to ignore.

@ArturT ArturT merged commit f71453b into master Jun 19, 2024
45 checks passed
@ArturT ArturT deleted the timecop-fix branch June 19, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants