Mercurial > hg > autobot
annotate autobot/projects/autobot/__init__.py @ 258:8ed63380052e
use test bot and dont try to connect to irc when testing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 28 Dec 2011 16:44:07 -0800 |
parents | 44ca3474d03d |
children | aa36f82313f1 |
rev | line source |
---|---|
71
a1568668175c
make the autobot project possibly do something
Jeff Hammel <jhammel@mozilla.com>
parents:
33
diff
changeset
|
1 from autobot.process.factory import PythonSourceFactory |
74
d94fbaac7c2c
stub out being able to find scripts cross-platform in a virtualenv
Jeff Hammel <jhammel@mozilla.com>
parents:
71
diff
changeset
|
2 from buildbot.steps.shell import ShellCommand |
d94fbaac7c2c
stub out being able to find scripts cross-platform in a virtualenv
Jeff Hammel <jhammel@mozilla.com>
parents:
71
diff
changeset
|
3 from buildbot.steps.shell import WithProperties |
33
cbeca1aea406
stub out autobot testing itself
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 |
71
a1568668175c
make the autobot project possibly do something
Jeff Hammel <jhammel@mozilla.com>
parents:
33
diff
changeset
|
5 class TestAutobotFactory(PythonSourceFactory): |
33
cbeca1aea406
stub out autobot testing itself
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 """ |
cbeca1aea406
stub out autobot testing itself
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 factory to test autobot |
cbeca1aea406
stub out autobot testing itself
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 """ |
134
a67fb62c04a6
start adding sources to the master.mfg
Jeff Hammel <jhammel@mozilla.com>
parents:
131
diff
changeset
|
9 |
139
a0866ad63d93
fix another syntax error andadd the error handling to detect it
Jeff Hammel <jhammel@mozilla.com>
parents:
134
diff
changeset
|
10 sources = {'hg': ['http://k0s.org/mozilla/hg/autobot']} |
134
a67fb62c04a6
start adding sources to the master.mfg
Jeff Hammel <jhammel@mozilla.com>
parents:
131
diff
changeset
|
11 |
234 | 12 def __init__(self, platform=None, slaveport=7357, htmlport=7358, hg=None): |
33
cbeca1aea406
stub out autobot testing itself
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 |
cbeca1aea406
stub out autobot testing itself
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 # setup the environment |
234 | 15 PythonSourceFactory.__init__(self, platform=platform, name='autobot', hg=hg) |
33
cbeca1aea406
stub out autobot testing itself
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 |
92 | 17 # find the necessary scripts |
77
7493ba72cce7
* use absolute paths for finding (works in unix bash)
Jeff Hammel <jhammel@mozilla.com>
parents:
74
diff
changeset
|
18 self.findScript('create-autobot') |
92 | 19 self.findScript('buildbot') |
20 self.findScript('buildslave') | |
21 | |
22 # make sure the template creator actually does something | |
23 self.addStep(ShellCommand(command=[WithProperties('%(create-autobot)s'), | |
24 '--list-factories'], | |
25 description='create-autobot --list-factories')) | |
26 | |
27 # make a master, slave pair | |
28 self.addStep(ShellCommand(command=[WithProperties('%(create-autobot)s'), | |
29 '-f', '-', # all factories, | |
258
8ed63380052e
use test bot and dont try to connect to irc when testing
Jeff Hammel <jhammel@mozilla.com>
parents:
234
diff
changeset
|
30 '--ircChannels', '', # no channels |
129
a622d6b4db4a
use non-default ports for testing
Jeff Hammel <jhammel@mozilla.com>
parents:
95
diff
changeset
|
31 '--slaveport', str(slaveport), |
131
a14d466c843b
fix syntax error and note import errors in projects
Jeff Hammel <jhammel@mozilla.com>
parents:
129
diff
changeset
|
32 '--htmlport', str(htmlport), |
95 | 33 'bot'], |
92 | 34 description="make an autobot", |
129
a622d6b4db4a
use non-default ports for testing
Jeff Hammel <jhammel@mozilla.com>
parents:
95
diff
changeset
|
35 workdir=WithProperties('%(virtualenv)s'), |
a622d6b4db4a
use non-default ports for testing
Jeff Hammel <jhammel@mozilla.com>
parents:
95
diff
changeset
|
36 haltOnFailure=True)) |
92 | 37 |
38 | |
39 # make sure they start | |
40 self.addStep(ShellCommand(command=[WithProperties('%(buildbot)s'), | |
41 'start', 'master'], | |
42 workdir=WithProperties('%(virtualenv)s/bot'), | |
43 description='start build master')) | |
44 self.addStep(ShellCommand(command=[WithProperties('%(buildslave)s'), | |
45 'start', 'slave'], | |
46 workdir=WithProperties('%(virtualenv)s/bot'), | |
47 description='start build slave')) | |
48 | |
49 | |
50 # try to access the waterfall | |
129
a622d6b4db4a
use non-default ports for testing
Jeff Hammel <jhammel@mozilla.com>
parents:
95
diff
changeset
|
51 self.addStep(ShellCommand(command=['curl', |
a622d6b4db4a
use non-default ports for testing
Jeff Hammel <jhammel@mozilla.com>
parents:
95
diff
changeset
|
52 'http://localhost:%s/' % htmlport])) |
92 | 53 |
129
a622d6b4db4a
use non-default ports for testing
Jeff Hammel <jhammel@mozilla.com>
parents:
95
diff
changeset
|
54 # could try to actually build, but we won't here |
92 | 55 |
56 # stop them! | |
57 self.addStep(ShellCommand(command=[WithProperties('%(buildbot)s'), | |
58 'stop', 'master'], | |
59 workdir=WithProperties('%(virtualenv)s/bot'), | |
60 description='stop build master')) | |
61 self.addStep(ShellCommand(command=[WithProperties('%(buildslave)s'), | |
62 'stop', 'slave'], | |
63 workdir=WithProperties('%(virtualenv)s/bot'), | |
64 description='stop build slave')) |