Skip to content

fix time-dependent spec failure on macOS

Alessio Caiazza requested to merge fix-notify-branch-too-far-behind-spec into master

What does this MR do and why?

Fix time-dependent spec failure on macOS

AutoDeployBranchService can notify branches where the next commit is older than 7 days.

However, time precision on macOS is not the same as Linux, and on a fast macOS machine, it is possible for the current test not to trigger the intended behavior.

On macOS:

irb(main):001:0> Time.now
=> 2023-03-27 15:31:41.601407 +0200

On Linux:

irb(main):001:0> Time.now
=> 2023-03-27 13:38:50.171805236 +0000

Current failure on macOS:

Failures:

  1) ReleaseTools::Services::AutoDeployBranchService#create_branches! when next commit is more than 7 days old returns notify_branch_too_far_behind true
     Failure/Error: expect(res1.notify_branch_too_far_behind).to be(true)

       expected true
            got false
     # ./spec/lib/release_tools/services/auto_deploy_branch_service_spec.rb:169:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:48:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

Finished in 0.01669 seconds (files took 1.25 seconds to load)
4 examples, 1 failure

Failed examples:

rspec ./spec/lib/release_tools/services/auto_deploy_branch_service_spec.rb:135 # ReleaseTools::Services::AutoDeployBranchService#create_branches! when next commit is more than 7 days old returns notify_branch_too_far_behind true

Randomized with seed 19464

Author Check-list

  • Has documentation been updated?
Edited by Alessio Caiazza

Merge request reports