jmettraux/rufus-scheduler

Frequently failing Rufus::Scheduler#around_trigger does not block test

dleidert opened this issue · 7 comments

We frequently see this error happening when running the tests:

Failures:

  1) Rufus::Scheduler#around_trigger does not block (runs in job thread)
     Failure/Error:
       expect($out.take(3)).to eq([
         "pre #{job_id1}",
         "pre #{job_id2}",
         job_id2
       ])
     
       expected: ["pre in_1637693274.4262948_0.0_6560", "pre in_1637693274.4293563_0.0_6580", "in_1637693274.4293563_0.0_6580"]
            got: ["pre in_1637693274.4293563_0.0_6580", "pre in_1637693274.4262948_0.0_6560", "in_1637693274.4293563_0.0_6580"]
     
       (compared using ==)
     # ./spec/scheduler_spec.rb:1341:in `block (3 levels) in <top (required)>'

And there are other test issues when we build the package in our CI:

Failures:
  1) Rufus::Scheduler#unschedule(job_or_work_id) carefully unschedules repeat jobs
     Failure/Error: expect(counter).to eq(c)
       expected: 2
            got: 3
       (compared using ==)
     # ./spec/scheduler_spec.rb:289:in `block (3 levels) in <top (required)>'

https://salsa.debian.org/ruby-team/ruby-rufus-scheduler/-/jobs/2210494

The following is also from our CI for the i386 architecture.

Failures:
  1) Rufus::Scheduler#occurrences(time0, time1) respects :times for repeat jobs
     Failure/Error: expect(h[j0].size).to eq(6)
       expected: 6
            got: 5
       (compared using ==)
     # ./spec/scheduler_spec.rb:663:in `block (3 levels) in <top (required)>'

https://salsa.debian.org/ruby-team/ruby-rufus-scheduler/-/jobs/2210495

And another one:

Failures:

  1) Rufus::Scheduler::Job work time #mean_work_time gathers work times and computes the mean
     Failure/Error: expect(job.last_work_time).to be < 0.0999

       expected: < 0.0999
            got:   0.10017538070678711
     # ./spec/job_spec.rb:765:in `block (4 levels) in <top (required)>'

Finished in 7 minutes 12 seconds (files took 0.47826 seconds to load)
309 examples, 1 failure, 2 pending

Failed examples:

rspec ./spec/job_spec.rb:753 # Rufus::Scheduler::Job work time #mean_work_time gathers work times and computes the mean

https://buildd.debian.org/status/fetch.php?pkg=ruby-rufus-scheduler&arch=all&ver=3.8.0-1&stamp=1637697884&raw=0

OK, I will harden those tests. Thanks for reporting.

@jmettraux, thanks, I still see random test failures:

  1) Rufus::Scheduler#occurrences(time0, time1) respects :times for repeat jobs
     Failure/Error: expect(h[j0].size).to eq(6)

       expected: 6
            got: 5

       (compared using ==)
     # ./spec/scheduler_spec.rb:663:in `block (3 levels) in <top (required)>'

This one appeared just twice in two different environments. Our builders sometimes experience a heavy load. Can this affect the outcome?

@dleidert wrote:

Our builders sometimes experience a heavy load. Can this affect the outcome?

Yes, it's possible.

Thanks for reporting again, I will go on with this work over the week-end. I will make sure load doesn't affect the tests.

Hello, it should be OK by now. Please tell me if you still see errors.

Thanks again.

Fix included in release 3.8.1 (and 3.8.2).