From d202456a17833ea40c1e13efca8a8b249e359605 Mon Sep 17 00:00:00 2001 From: Paul Simpson Date: Wed, 17 Apr 2013 13:21:26 -0700 Subject: [PATCH] Remove unneeded legacy test around reconnect. Now that we're testing this behavior in the client, we don't need this mega-gross, complicated, flaky test. --- test/legacy/worker_test.rb | 59 -------------------------------------- 1 file changed, 59 deletions(-) diff --git a/test/legacy/worker_test.rb b/test/legacy/worker_test.rb index 68d2c8cd2..5ac8bf936 100644 --- a/test/legacy/worker_test.rb +++ b/test/legacy/worker_test.rb @@ -663,65 +663,6 @@ def self.perform end end - it "tries to reconnect three times before giving up" do - skip "JRuby doesn't fork." if jruby? - - begin - class Redis::Client - alias_method :original_reconnect, :reconnect - - #warning: previous definition of reconnect was here - silence_warnings do - def reconnect - val = File.exists?("reconnect_test.txt") ? File.read("reconnect_test.txt").to_i : 0 - File.open("reconnect_test.txt", "w+") {|f| f.write(val + 1)} - raise Redis::BaseConnectionError - end - end - end - - class Resque::Worker - alias_method :original_sleep, :sleep - # warning: method redefined; - silence_warnings do - def sleep(duration = nil) - # noop - end - end - end - - # Make sure we haven't been flagged as reconnected (from previous tests) - worker.instance_variable_set(:@reconnected, false) - worker.stub(:will_fork?, true) do - # The 4th try gives up and throws an exception - begin - worker.work - rescue - end - - skip "Flaky test: skipping." unless File.exists?("reconnect_test.txt") - val = File.read("reconnect_test.txt").to_i - assert_equal 4, val - end - ensure - File.delete("reconnect_test.txt") if File.exists?("reconnect_test.txt") - - class Redis::Client - # warning: method redefined; - silence_warnings do - alias_method :reconnect, :original_reconnect - end - end - - class Resque::Worker - # warning: method redefined; - silence_warnings do - alias_method :sleep, :original_sleep - end - end - end - end - it "will call before_pause before it is paused" do # this test is kinda weird and complex, so let's punt # and use real redis to make sure we don't break stuff