Bug#846020: ruby-clockwork: FTBFS (Clockwork::DatabaseEvents::SyncPerformer::setup::when fails)
Package: ruby-clockwork Followup-For: Bug #846020 Attach a patch to disable this specific test that randomly fails on havey load machine. Best regards, -Andrew Description: Disable test due to randomly fails on heavy load machine Bug-Debian: https://bugs.debian.org/846020 Reviewed-By: Andrew Lee (李健秋) Last-Update: <2016-12-30> --- ruby-clockwork-1.2.0.orig/test/database_events/sync_performer_test.rb +++ /dev/null @@ -1,291 +0,0 @@ -require "minitest/autorun" -require 'mocha/setup' -require 'time' -require 'active_support/time' - -require_relative '../../lib/clockwork' -require_relative '../../lib/clockwork/database_events' -require_relative 'test_helpers' - -describe Clockwork::DatabaseEvents::SyncPerformer do - before do -@now = Time.now -DatabaseEventModel.delete_all -DatabaseEventModel2.delete_all - -Clockwork.manager = @manager = Clockwork::DatabaseEvents::Manager.new -class << @manager - def log(msg); end # silence log output -end - end - - after do -Clockwork.clear! - end - - describe "setup" do -before do - @subject = Clockwork::DatabaseEvents::SyncPerformer -end - -describe "arguments" do - it 'raises argument error if model is not set' do -error = assert_raises KeyError do - @subject.setup(every: 1.minute) {} -end -assert_equal error.message, ":model must be set to the model class" - end - - it 'raises argument error if every is not set' do -error = assert_raises KeyError do - @subject.setup(model: DatabaseEventModel) {} -end -assert_equal error.message, ":every must be set to the database sync frequency" - end -end - -describe "when database reload frequency is greater than model frequency period" do - before do -@events_run = [] -@sync_frequency = 1.minute - end - - it 'fetches and registers event from database' do -DatabaseEventModel.create(:frequency => 10) -setup_sync(model: DatabaseEventModel, :every => @sync_frequency, :events_run => @events_run) - -tick_at(@now, :and_every_second_for => 1.second) - -assert_equal ["DatabaseEventModel:1"], @events_run - end - - it 'fetches and registers multiple events from database' do -DatabaseEventModel.create(:frequency => 10) -DatabaseEventModel.create(:frequency => 10) -setup_sync(model: DatabaseEventModel, :every => @sync_frequency, :events_run => @events_run) - -tick_at(@now, :and_every_second_for => 1.second) - -assert_equal ["DatabaseEventModel:1", "DatabaseEventModel:2"], @events_run - end - - it 'does not run event again before frequency specified in database' do -model = DatabaseEventModel.create(:frequency => 10) -setup_sync(model: DatabaseEventModel, :every => @sync_frequency, :events_run => @events_run) - -tick_at(@now, :and_every_second_for => model.frequency - 1.second) -assert_equal 1, @events_run.length - end - - it 'runs event repeatedly with frequency specified in database' do -model = DatabaseEventModel.create(:frequency => 10) -setup_sync(model: DatabaseEventModel, :every => @sync_frequency, :events_run => @events_run) - -tick_at(@now, :and_every_second_for => (2 * model.frequency) + 1.second) - -assert_equal 3, @events_run.length - end - - it 'runs reloaded events from database repeatedly' do -model = DatabaseEventModel.create(:frequency => 10) -setup_sync(model: DatabaseEventModel, :every => @sync_frequency, :events_run => @events_run) - -tick_at(@now, :and_every_second_for => @sync_frequency - 1) -model.update(:name => "DatabaseEventModel:1:Reloaded") -tick_at(@now + @sync_frequency, :and_every_second_for => model.frequency * 2) - -assert_equal ["DatabaseEventModel:1:Reloaded", "DatabaseEventModel:1:Reloaded"], @events_run[-2..-1] - end - - it 'updates modified event frequency with event reloading' do -model = DatabaseEventModel.create(:frequency => 10) -setup_sync(model: DatabaseEventModel, :every => @sync_frequency, :events_run => @events_run) - -tick_at(@now, :and_every_second_for => @sync_frequency - 1.second) -model.update(:frequency => 5) -tick_at(@now + @sync_frequency, :and_every_second_for => 6.seconds) - -# model runs at: 1, 11, 21, 31, 41, 51 (6 runs) -# database sync happens at: 60 -# modified model runs at: 61 (next tick after reload) and then 66 (2 runs) -assert_equal 8, @events_run.length - end - - it 'stoped running deleted events from database' do -model = DatabaseEventModel.create(:frequency => 10) -setup_sync(model: DatabaseEventModel, :every => @sync_frequency, :events_run => @events_run) - -tick_at(@now, :and_every_second_for => (@sync_frequency - 1.second)) -before = @events_run.dup -
Bug#846020: ruby-clockwork: FTBFS (Clockwork::DatabaseEvents::SyncPerformer::setup::when fails)
Package: src:ruby-clockwork Version: 1.2.0-3 Severity: serious Dear maintainer: I tried to build this package in stretch with "dpkg-buildpackage -A" (which is what the "Arch: all" autobuilder would do to build it) but it failed: [...] debian/rules build-indep dh build-indep --buildsystem=ruby --with ruby dh_testdir -i -O--buildsystem=ruby dh_update_autotools_config -i -O--buildsystem=ruby dh_auto_configure -i -O--buildsystem=ruby dh_ruby --configure dh_auto_build -i -O--buildsystem=ruby dh_ruby --build dh_ruby --build dh_auto_test -i -O--buildsystem=ruby dh_ruby --test fakeroot debian/rules binary-indep dh binary-indep --buildsystem=ruby --with ruby [... snipped ...] Clockwork::Event::#thread?::manager config thread option set to true#test_0001_is true = 0.00 s = . Clockwork::Manager::max_threads#test_0001_should warn when an event tries to generate threads more than max_threads = 0.00 s = . Clockwork::Manager::max_threads#test_0002_should not warn when thread is managed by others = 0.00 s = . Clockwork::DatabaseEvents::SyncPerformer::setup::arguments#test_0001_raises argument error if model is not set = 0.00 s = . Clockwork::DatabaseEvents::SyncPerformer::setup::arguments#test_0002_raises argument error if every is not set = 0.00 s = . Clockwork#test_0003_should pass event without modification to handler = 0.00 s = . Clockwork#test_0005_should pass all arguments to every = 0.00 s = . Clockwork#test_0004_should not run anything after reset = 0.00 s = . Clockwork#test_0002_should log event correctly = 0.00 s = . Clockwork#test_0006_support module re-open style = 0.00 s = . Clockwork#test_0001_should run events with configured logger = 0.00 s = . Clockwork::Manager::callbacks#test_0005_should run even jobs only = 0.00 s = . Clockwork::Manager::callbacks#test_0001_should not accept unknown callback name = 0.00 s = . Clockwork::Manager::callbacks#test_0004_should run before_run twice if two events are registered = 0.00 s = . Clockwork::Manager::callbacks#test_0002_should run before_tick callback once on tick = 0.00 s = . Clockwork::Manager::callbacks#test_0003_should not run events if before_tick returns false = 0.00 s = . Clockwork::Manager::callbacks#test_0006_should run after_run callback for each event = 0.00 s = . Clockwork::Manager::callbacks#test_0007_should run after_tick callback once = 0.00 s = . Clockwork::Manager:::if option#test_0002_:if false then never run = 0.00 s = . Clockwork::Manager:::if option#test_0001_:if true then always run = 0.00 s = . Clockwork::Manager:::if option#test_0003_:if the first day of month = 0.00 s = . Clockwork::Manager:::if option#test_0005_:if is not callable then raise ArgumentError = 0.00 s = . Clockwork::Manager:::if option#test_0004_:if it is compared to a time with zone = 0.01 s = . Clockwork::Manager:::tz option#test_0005_should be able to override a default timezone in an event = 0.01 s = . Clockwork::Manager:::tz option#test_0002_should be able to specify a different timezone than local = 0.00 s = . Clockwork::Manager:::tz option#test_0004_should be able to configure a default timezone to use for all events = 0.00 s = . Clockwork::Manager:::tz option#test_0001_time zone is not set by default = 0.00 s = . Clockwork::Manager:::tz option#test_0003_should be able to specify a different timezone than local for multiple times = 0.00 s = . Finished in 0.909811s, 93.4260 runs/s, 165.9686 assertions/s. 1) Failure: Clockwork::DatabaseEvents::SyncPerformer::setup::when database reload frequency is greater than model frequency period#test_0010_updates event at with new at [/<>/test/database_events/sync_performer_test.rb:161]: Expected: 1 Actual: 0 85 runs, 151 assertions, 1 failures, 0 errors, 0 skips rake aborted! Command failed with status (1): [ruby -I"test" "/usr/lib/ruby/vendor_ruby/rake/rake_test_loader.rb" "test/at_test.rb" "test/clockwork_test.rb" "test/database_events/sync_performer_test.rb" "test/event_test.rb" "test/manager_test.rb" "test/database_events/test_helpers.rb" -v] Tasks: TOP => default (See full trace by running task with --trace) ERROR: Test "ruby2.3" failed. Exiting. dh_auto_install: dh_ruby --install /<>/debian/ruby-clockwork returned exit code 1 debian/rules:6: recipe for target 'binary-indep' failed make: *** [binary-indep] Error 1 dpkg-buildpackage: error: fakeroot debian/rules binary-indep gave error exit status 2 The failure happens randomly. Sometimes it fails, sometimes it does not. It does happen, in fact, with a very low probability, but it also happened at least once in the reproducible builds autobuilder: https://tests.reproducible-builds.org/debian/logs/testing/amd64/ruby-clockwork_1.2.0-3.build2.log.gz The test seems to measure that a certain process takes a certain amount of time (reload