Beefed up Complex test method #49

wants to merge 2 commits into

3 participants


I got my Rails processes (using thin) to wait until beanstalkd is running. The recipe I used is:

w.start_if do |start|
  start.condition(:complex) do |c|
    c.interval = 1.minute
    c.this(:process_running) do |p|
      p.running = false
    c.and(:process_running) do |p|
      p.pid_file = $beanstalkd.pid_file
      p.running = true

The way I start beanstalkd is:

w.pid_file = w.pid_file
w.start = "/usr/local/bin/beanstalkd & echo $! > #{w.pid_file}"

If the start is slow (I added a sleep in front of it), the pid file doesn't exist and I was have problems with Complex throwing errors. I now catch the errors and assume the test is "false" in that case. It probably should chnage it so that nothing is thrown but this got me working.

If I start beanstalkd the recommended way of not setting the pid file I get some sort of hang due to locking issues. That may be a Ruby bug. I am using Ruby 1.9.1 p378. I'll do some more experimenting and see if I can strengthen it up a bit.

Is God dead? The google groups looks like a ghost town. Is there a new kid on the block? With the current level of documentation (basically the single front page), doing anything unusual (like using Complex) requires a lot of work. And the code is not well documented so it makes it hard. It kinda seems like someone's freshman project. I'm surprised so many people suggested I use it.

pedz added some commits Jun 19, 2011
@pedz pedz Make Complex conditions more robust 292c70e
@pedz pedz Fixed daemonizing code
On a strict compliant system, a child can not exit until all the data
from its pipes have been read.  We need to read the data before
waiting for the process to exit

I'll be helping Eric and Tom to get up to date with Ruby 1.9. God is far from dead, it just needs lots of loving. Please remember though that Ruby 1.9.1 is a buggy release and has been known to randomly break applications. Any 1.9 compatible work made to God will be tested against 1.9.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment