view autobot/projects/autobot/__init__.py @ 129:a622d6b4db4a

use non-default ports for testing
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 23 Jan 2011 10:54:14 -0800
parents 4ed9a96dbb82
children a14d466c843b
line wrap: on
line source

from autobot.process.factory import PythonSourceFactory
from buildbot.steps.shell import ShellCommand
from buildbot.steps.shell import WithProperties

class TestAutobotFactory(PythonSourceFactory):
  """
  factory to test autobot
  """
  def __init__(self, slaveport=7357, htmlport=7358):

    # setup the environment
    PythonSourceFactory.__init__(self, name='autobot',
                                 hg_sources=['http://k0s.org/mozilla/hg/autobot'])

    # find the necessary scripts
    self.findScript('create-autobot')
    self.findScript('buildbot')
    self.findScript('buildslave')

    # make sure the template creator actually does something
    self.addStep(ShellCommand(command=[WithProperties('%(create-autobot)s'),
                                       '--list-factories'],
                              description='create-autobot --list-factories'))

    # make a master, slave pair
    self.addStep(ShellCommand(command=[WithProperties('%(create-autobot)s'),
                                       '-f', '-', # all factories,
                                       '--slaveport', str(slaveport),
                                       '--htmlport', str(htmlport)
                                       'bot'],
                              description="make an autobot",
                              workdir=WithProperties('%(virtualenv)s'),
                              haltOnFailure=True))



    # make sure they start
    self.addStep(ShellCommand(command=[WithProperties('%(buildbot)s'),
                                       'start', 'master'],
                              workdir=WithProperties('%(virtualenv)s/bot'),
                              description='start build master'))
    self.addStep(ShellCommand(command=[WithProperties('%(buildslave)s'),
                                       'start', 'slave'],
                              workdir=WithProperties('%(virtualenv)s/bot'),
                              description='start build slave'))
    

    # try to access the waterfall
    self.addStep(ShellCommand(command=['curl',
                                       'http://localhost:%s/' % htmlport]))

    # could try to actually build, but we won't here

    # stop them!
    self.addStep(ShellCommand(command=[WithProperties('%(buildbot)s'),
                                       'stop', 'master'],
                              workdir=WithProperties('%(virtualenv)s/bot'),
                              description='stop build master'))
    self.addStep(ShellCommand(command=[WithProperties('%(buildslave)s'),
                                       'stop', 'slave'],
                              workdir=WithProperties('%(virtualenv)s/bot'),
                              description='stop build slave'))