Skip to content

Commit

Permalink
Merge pull request #185 from DataDog/anmarchenko/timecop_time_provide…
Browse files Browse the repository at this point in the history
…r_config

[NO-TICKET] automatically trace with correct time even when time is stubbed by timecop
  • Loading branch information
anmarchenko authored May 30, 2024
2 parents cbf442b + 4fa4efb commit b997340
Show file tree
Hide file tree
Showing 235 changed files with 1,233 additions and 462 deletions.
2 changes: 2 additions & 0 deletions .standard_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ ignore:
- Style/Alias
- spec/datadog/ci/contrib/minitest/instrumentation_spec.rb:
- Lint/ConstantDefinitionInBlock
- spec/datadog/ci/contrib/timecop/instrumentation_spec.rb:
- Lint/ConstantDefinitionInBlock
11 changes: 11 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ def self.with_selenium_gem(selenium_versions: 4, capybara_versions: 3)
end
end

def self.with_timecop_gem(timecop_versions: 0)
Array(timecop_versions).each do |timecop_v|
appraise "timecop-#{timecop_v}" do
gem "timecop", "~> #{timecop_v}"

gem "minitest", "~> 5"
end
end
end

ruby_version = Gem::Version.new(RUBY_ENGINE_VERSION)
major, minor, = ruby_version.segments

Expand All @@ -161,6 +171,7 @@ with_minitest_shoulda_context_gem if ruby_version >= Gem::Version.new("3.1")
with_active_support_gem(versions: 4..7)
with_knapsack_pro_rspec_gem
with_selenium_gem if ruby_version >= Gem::Version.new("3.0")
with_timecop_gem

ruby_runtime = "#{RUBY_ENGINE}-#{major}.#{minor}"

Expand Down
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ gem "os"
# To compile native extensions
gem "rake-compiler"

gem "climate_control"

gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"

gem "standard", "~> 1.31"

Expand Down
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ TEST_METADATA = {
},
"selenium" => {
"selenium-4-capybara-3" => "❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby"
},
"timecop" => {
"timecop-0" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby"
}
}

Expand Down Expand Up @@ -140,7 +143,8 @@ namespace :spec do
:ci_queue_rspec,
:knapsack_rspec,
:knapsack_rspec_go,
:selenium
:selenium,
:timecop
].each do |contrib|
desc "" # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(contrib) do |t, args|
Expand Down
1 change: 1 addition & 0 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ target :lib do
library "bundler"
library "selenium-webdriver"
library "capybara"
library "timecop"
end
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_activesupport_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_activesupport_4.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ GEM
strscan (3.1.0-java)
thor (1.3.1)
thread_safe (0.3.6-java)
timecop (0.9.8)
tzinfo (1.2.11)
thread_safe (~> 0.1)
unicode-display_width (2.5.0)
Expand All @@ -147,7 +146,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_activesupport_5.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_activesupport_5.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ GEM
strscan (3.1.0-java)
thor (1.3.1)
thread_safe (0.3.6-java)
timecop (0.9.8)
tzinfo (1.2.11)
thread_safe (~> 0.1)
unicode-display_width (2.5.0)
Expand All @@ -147,7 +146,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_activesupport_6.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_activesupport_6.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ GEM
rubocop-performance (~> 1.21.0)
strscan (3.1.0-java)
thor (1.3.1)
timecop (0.9.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand Down Expand Up @@ -148,7 +147,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_activesupport_7.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_activesupport_7.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ GEM
rubocop-performance (~> 1.21.0)
strscan (3.1.0-java)
thor (1.3.1)
timecop (0.9.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand All @@ -155,7 +154,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_ci_queue_0_minitest_5.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_ci_queue_0_minitest_5.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ GEM
rubocop-performance (~> 1.21.0)
strscan (3.1.0-java)
thor (1.3.1)
timecop (0.9.8)
unicode-display_width (2.5.0)
webrick (1.8.1)
yard (0.9.36)
Expand All @@ -144,7 +143,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_ci_queue_0_rspec_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec", "~> 3"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_ci_queue_0_rspec_3.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ GEM
rubocop-performance (~> 1.21.0)
strscan (3.1.0-java)
thor (1.3.1)
timecop (0.9.8)
unicode-display_width (2.5.0)
webrick (1.8.1)
yard (0.9.36)
Expand All @@ -134,7 +133,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_cucumber_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_cucumber_3.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ GEM
rubocop-performance (~> 1.21.0)
strscan (3.1.0-java)
thor (1.3.1)
timecop (0.9.8)
unicode-display_width (2.5.0)
webrick (1.8.1)
yard (0.9.36)
Expand All @@ -154,7 +153,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_cucumber_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_cucumber_4.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ GEM
ffi (~> 1.1)
thor (1.3.1)
thread_safe (0.3.6-java)
timecop (0.9.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand All @@ -187,7 +186,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_cucumber_5.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_cucumber_5.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ GEM
ffi (~> 1.1)
thor (1.3.1)
thread_safe (0.3.6-java)
timecop (0.9.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand All @@ -187,7 +186,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_cucumber_6.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/jruby_9.4_cucumber_6.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ GEM
ffi (~> 1.1)
thor (1.3.1)
thread_safe (0.3.6-java)
timecop (0.9.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand All @@ -191,7 +190,6 @@ DEPENDENCIES
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop
webrick
yard

Expand Down
3 changes: 1 addition & 2 deletions gemfiles/jruby_9.4_cucumber_7.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "climate_control"
gem "appraisal"
gem "timecop"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
Expand Down
Loading

0 comments on commit b997340

Please sign in to comment.