PS: Here''s what I''m doing right now - but it''s not
working. I the test
runs, but gets stuck in an infinite loop selecting from
bdrb_job_queues. Any help would be wonderful. I''m pretty stuck.
# TEST CASE =========
require File.dirname(__FILE__) + ''/../test_helper''
require File.join(File.dirname(__FILE__) + "/../bdrb_test_helper")
require "cancel_account_worker"
class CancelAccountWorkerTest < Test::Unit::TestCase
fixtures(:all)
def setup
`ruby #{File.join(RAILS_ROOT, ''script/backgroundrb'')}
start -e test`
end
def teardown
`ruby #{File.join(RAILS_ROOT, ''script/backgroundrb'')}
stop`
end
def test_cancel_account
acct = accounts(:paid)
worker = MiddleMan.worker(:cancel_account_worker).do_work(:account_id
=> acct.id)
assert_nil Account.find_by_id(acct.id)
end
end
# INFINITE SQL LOOP FROM LOGS =========
SQL (0.000290) BEGIN
BdrbJobQueue Load (0.000417) SELECT * FROM `bdrb_job_queues` WHERE
( worker_name = ''send_document_worker'' AND taken = 0 AND
scheduled_at
<= ''2008-11-18 03:12:26'' ) LIMIT 1 FOR UPDATE
SQL (0.000098) COMMIT
SQL (0.000392) BEGIN
BdrbJobQueue Load (0.000743) SELECT * FROM `bdrb_job_queues` WHERE
( worker_name = ''exporter_worker'' AND taken = 0 AND
scheduled_at <''2008-11-18 03:12:30'' ) LIMIT 1 FOR UPDATE
SQL (0.000129) COMMIT
SQL (0.000502) BEGIN
BdrbJobQueue Load (0.000770) SELECT * FROM `bdrb_job_queues` WHERE
( worker_name = ''basecamp_sync_worker'' AND taken = 0 AND
scheduled_at
<= ''2008-11-18 03:12:31'' ) LIMIT 1 FOR UPDATE
SQL (0.000195) COMMIT
.....etc, etc etc.
--------------------
seth - subimage llc
-----
http://sublog.subimage.com
-----
Cashboard - Estimates, invoices, and time tracking software - for free!
http://www.getcashboard.com
-----
Substruct - Open source RoR e-commerce software.
http://code.google.com/p/substruct/
On Mon, Nov 17, 2008 at 7:07 PM, seth b <subimage at gmail.com>
wrote:> Hello again BDRB folks.
>
> I''m attempting to push forward with my upgrade from 0.2.1 of DRB.
At
> the moment I''m trying to run with TDD and test my workers properly
> before putting them into action.
>
> However, I''m running into some questions while doing so.
>
> First, I ran into the issue that my DRB server was not running prior
> to my tests. I started this up manually, but for times when I run
> autotest I''d like to automate this process (startup and shutdown).
Is
> anyone doing such a thing and could provide some insight into a slick
> way to accomplish it?
>
> Thanks in advance.
>
> --------------------
> seth - subimage llc
> -----
> http://sublog.subimage.com
> -----
> Cashboard - Estimates, invoices, and time tracking software - for free!
> http://www.getcashboard.com
> -----
> Substruct - Open source RoR e-commerce software.
> http://code.google.com/p/substruct/
>