One of the things that’s plagued our buildbot config for a while is how to know when the web servers are really up and ready to take requests. For a while, I had buildbot configured to just sleep for a while and then start running flunc. This would eventually fail when the box was under heavy load; the flunc tests would start when things weren’t ready . I suppose I could keep doubling the sleep time, but I wanted something more meaningful.

I finally came up with a hack that seems to be reliable - use wget to actually request a page from the app and block until it returns or times out. Something like this:

fac.addStep(ShellCommand,
            command=('%s/bin/supervisord && sleep 10 && wget '
                     '--retry-connrefused --tries=10 -T 100 --spider '
                     'http://localhost:%d' % (OCBASEDIR, ports[1])),
            description=['start services', 'for functional tests'],
            haltOnFailure=True)


The full config (or rather, a template for it) can be seen in our source control here.

Another problem was that the services sometimes didn’t get shut down properly. I hacked a bit on jeff’s very handy portutils package until it seemed to do the trick.

Filed April 10th, 2008 under flunc, testing, Python

Just landed a few changes that had been hanging out in the wings for awhile that I wanted to let folks know about. This has to do with getting flunc into the opencore distribution, a personal itch stemming from having extra steps to set up the ftesting (which I found myself plain forgetting to do).

So here’s where things are::

  1. opencore’s ftests now ship with opencore (in… opencore/ftests). This should help keep things in sync. For bbb purposes, the ftesting bundle is updated to look at opencore trunk’s ftests.
  2. flunc now comes with a setuptools extension that allows for the running of flunc tests inside a package from setup.py. This doesn’t provide overwhelming convenience, but does take the guess work out of remember to use -p. Later, this hopefully will grow a bit more sophisticated as a test finder. For now the following command will run flunc (provided your zope is running on localhost:8080). It will also interpret the normal flunc options.

      $ cd opencore
      $ python setup.py flunc -vw
  3. flunc is now a dependency for opencore, meaning the flunc test running script is installed everytime you install opencore. And it works the same way as always, so if you choose, you can run the tests like so:

    ­

    $ flunc -vwp opencore/ftests all

    ­

As to which form of invocation works better, it’s apples and oranges (depending on perhaps what you are doing).  Framework-wise, there are some interesting things the setuptools command could let us do with organizing, finding and running ftests without changing the simplicity in how flunc works as a standalone script. More importantly, whichever way you run it, you are running the tests in the same way (or explicitly deviating by using the spelling in #3).

Filed November 20th, 2007 under flunc, testing, Help