Exemplo n.º 1
0
 def makeWorker(self, **kwargs):
     kwargs.setdefault('image', 'debian:wheezy')
     worker = HyperLatentWorker('bot', 'pass', 'tcp://hyper.sh/', 'foo', 'bar', **kwargs)
     self.worker = worker
     master = fakemaster.make_master(testcase=self, wantData=True)
     worker.setServiceParent(master)
     worker.reactor = self.reactor
     self.successResultOf(worker.startService())
     return worker
Exemplo n.º 2
0
 def makeWorker(self, **kwargs):
     kwargs.setdefault("image", "debian:wheezy")
     worker = HyperLatentWorker("bot", "pass", "tcp://hyper.sh/", "foo", "bar", **kwargs)
     self.worker = worker
     master = fakemaster.make_master(testcase=self, wantData=True)
     worker.setServiceParent(master)
     worker.reactor = self.reactor
     self.successResultOf(worker.startService())
     return worker
Exemplo n.º 3
0
 def makeWorker(self, **kwargs):
     kwargs.setdefault('image', 'debian:wheezy')
     worker = HyperLatentWorker('bot', 'pass', 'tcp://hyper.sh/', 'foo',
                                'bar', **kwargs)
     self.worker = worker
     master = fakemaster.make_master(testcase=self, wantData=True)
     worker.setServiceParent(master)
     worker.reactor = self.reactor
     self.successResultOf(master.startService())
     return worker
Exemplo n.º 4
0
 def test_constructor_badsize(self):
     with self.assertRaises(config.ConfigErrors):
         HyperLatentWorker('bot',
                           'pass',
                           'tcp://hyper.sh/',
                           'foo',
                           'bar',
                           'debian:wheezy',
                           hyper_size="big")
Exemplo n.º 5
0
def masterConfig(num_concurrent, extra_steps=None):
    if extra_steps is None:
        extra_steps = []
    c = {}

    c['schedulers'] = [
        schedulers.ForceScheduler(name="force", builderNames=["testy"])
    ]
    triggereables = []
    for i in range(num_concurrent):
        c['schedulers'].append(
            schedulers.Triggerable(name="trigsched" + str(i),
                                   builderNames=["build"]))
        triggereables.append("trigsched" + str(i))

    f = BuildFactory()
    f.addStep(steps.ShellCommand(command='echo hello'))
    f.addStep(
        steps.Trigger(schedulerNames=triggereables,
                      waitForFinish=True,
                      updateSourceStamp=True))
    f.addStep(steps.ShellCommand(command='echo world'))
    f2 = BuildFactory()
    f2.addStep(steps.ShellCommand(command='echo ola'))
    for step in extra_steps:
        f2.addStep(step)
    c['builders'] = [
        BuilderConfig(name="testy", workernames=["hyper0"], factory=f),
        BuilderConfig(
            name="build",
            workernames=["hyper" + str(i) for i in range(num_concurrent)],
            factory=f2)
    ]
    hyperconfig = workerhyper.Hyper.guess_config()
    if isinstance(hyperconfig, string_types):
        hyperconfig = json.load(open(hyperconfig))
    hyperhost, hyperconfig = hyperconfig['clouds'].items()[0]
    masterFQDN = os.environ.get('masterFQDN')
    c['workers'] = [
        HyperLatentWorker('hyper' + str(i),
                          'passwd',
                          hyperhost,
                          hyperconfig['accesskey'],
                          hyperconfig['secretkey'],
                          'buildbot/buildbot-worker:master',
                          masterFQDN=masterFQDN) for i in range(num_concurrent)
    ]
    # un comment for debugging what happens if things looks locked.
    # c['www'] = {'port': 8080}
    # if the masterFQDN is forced (proxy case), then we use 9989 default port
    # else, we try to find a free port
    if masterFQDN is not None:
        c['protocols'] = {"pb": {"port": "tcp:9989"}}
    else:
        c['protocols'] = {"pb": {"port": "tcp:0"}}

    return c
Exemplo n.º 6
0
def masterConfig():
    c = {}
    from buildbot.config import BuilderConfig
    from buildbot.process.factory import BuildFactory
    from buildbot.plugins import steps, schedulers

    c['schedulers'] = [
        schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"])
    ]
    triggereables = []
    for i in range(NUM_CONCURRENT):
        c['schedulers'].append(
            schedulers.Triggerable(name="trigsched" + str(i),
                                   builderNames=["build"]))
        triggereables.append("trigsched" + str(i))

    f = BuildFactory()
    f.addStep(steps.ShellCommand(command='echo hello'))
    f.addStep(
        steps.Trigger(schedulerNames=triggereables,
                      waitForFinish=True,
                      updateSourceStamp=True))
    f.addStep(steps.ShellCommand(command='echo world'))
    f2 = BuildFactory()
    f2.addStep(steps.ShellCommand(command='echo ola'))
    c['builders'] = [
        BuilderConfig(name="testy", workernames=["hyper0"], factory=f),
        BuilderConfig(
            name="build",
            workernames=["hyper" + str(i) for i in range(NUM_CONCURRENT)],
            factory=f2)
    ]
    hyperconfig = workerhyper.Hyper.guess_config()
    if isinstance(hyperconfig, string_types):
        hyperconfig = json.load(open(hyperconfig))
    hyperhost, hyperconfig = hyperconfig['clouds'].items()[0]
    masterFQDN = os.environ.get('masterFQDN')
    c['workers'] = [
        HyperLatentWorker('hyper' + str(i),
                          'passwd',
                          hyperhost,
                          hyperconfig['accesskey'],
                          hyperconfig['secretkey'],
                          'buildbot/buildbot-worker:master',
                          masterFQDN=masterFQDN) for i in range(NUM_CONCURRENT)
    ]
    # if the masterFQDN is forced (proxy case), then we use 9989 default port
    # else, we try to find a free port
    if masterFQDN is not None:
        c['protocols'] = {"pb": {"port": "tcp:9989"}}
    else:
        c['protocols'] = {"pb": {"port": "tcp:0"}}

    return c
Exemplo n.º 7
0
 def test_constructor_normal(self):
     worker = HyperLatentWorker('bot', 'pass', 'tcp://hyper.sh/', 'foo', 'bar', 'debian:wheezy')
     # class instanciation configures nothing
     self.assertEqual(worker.client, None)
     self.assertEqual(worker.client_args, None)
Exemplo n.º 8
0
 def test_constructor_nohyper(self):
     self.patch(workerhyper, 'Hyper', None)
     with self.assertRaises(config.ConfigErrors):
         HyperLatentWorker('bot', 'pass', 'tcp://hyper.sh/', 'foo', 'bar',
                           'debian:wheezy')