コード例 #1
0
ファイル: test_steps_slave.py プロジェクト: raxptor/buildbot
 def test_render(self):
     self.setupStep(slave.CopyDirectory(src=properties.Property("x"), dest=properties.Property("y")))
     self.properties.setProperty('x', 'XXX', 'here')
     self.properties.setProperty('y', 'YYY', 'here')
     self.expectCommands(
         Expect('cpdir', {'fromdir': 'XXX', 'todir': 'YYY'})
         + 0
     )
     self.expectOutcome(result=SUCCESS, state_string="Copied XXX to YYY")
     return self.runStep()
コード例 #2
0
ファイル: test_worker.py プロジェクト: pks-os/buildbot
 def test_render(self):
     self.setup_step(
         worker.CopyDirectory(src=properties.Property("x"),
                              dest=properties.Property("y")))
     self.properties.setProperty('x', 'XXX', 'here')
     self.properties.setProperty('y', 'YYY', 'here')
     self.expect_commands(
         ExpectCpdir(fromdir='XXX', todir='YYY', timeout=120).exit(0))
     self.expect_outcome(result=SUCCESS, state_string="Copied XXX to YYY")
     return self.run_step()
コード例 #3
0
 def test_render(self):
     self.setupStep(slave.FileExists(file=properties.Property("x")))
     self.properties.setProperty('x', 'XXX', 'here')
     self.expectCommands(Expect('stat', {'file': 'XXX'}) + 1)
     self.expectOutcome(result=FAILURE,
                        state_string="File not found. (failure)")
     return self.runStep()
コード例 #4
0
ファイル: test_shell.py プロジェクト: zmadi1/buildbot
    def test_suppressions_suppressionsRenderableParameter(self):
        def warningExtractor(step, line, match):
            return line.split(':', 2)

        supps = (
            ("abc.c", ".*", 100, 199),
            ("def.c", ".*", 22, 22),
        )

        step = shell.WarningCountingShellCommand(
            command=['make'],
            suppressionList=properties.Property("suppressionsList"),
            warningExtractor=warningExtractor)

        stdout = textwrap.dedent("""\
            abc.c:99: warning: seen 1
            abc.c:150: warning: unseen
            def.c:22: warning: unseen
            abc.c:200: warning: seen 2
            """)
        exp_warning_log = textwrap.dedent("""\
            abc.c:99: warning: seen 1
            abc.c:200: warning: seen 2
            """)
        return self.do_test_suppressions(step,
                                         None,
                                         stdout,
                                         2,
                                         exp_warning_log,
                                         props={"suppressionsList": supps})
コード例 #5
0
ファイル: test_worker.py プロジェクト: pks-os/buildbot
 def test_render(self):
     self.setup_step(worker.FileExists(file=properties.Property("x")))
     self.properties.setProperty('x', 'XXX', 'here')
     self.expect_commands(ExpectStat(file='XXX').exit(1))
     self.expect_outcome(result=FAILURE,
                         state_string="File not found. (failure)")
     return self.run_step()
コード例 #6
0
 def test_step_renders_flunkOnFailure(self):
     self.setupStep(
         TestBuildStep.FakeBuildStep(flunkOnFailure=properties.Property('fOF')))
     self.properties.setProperty('fOF', 'yes', 'test')
     self.expectOutcome(result=SUCCESS)
     yield self.runStep()
     self.assertEqual(self.step.flunkOnFailure, 'yes')
コード例 #7
0
 def test_description(self):
     self.setupStep(
         SimpleShellCommand(
             command=['foo', properties.Property('bar', 'BAR')]))
     self.expectCommands(
         ExpectShell(workdir='build', command=['foo', 'BAR']) + 0, )
     self.expectOutcome(result=SUCCESS, status_text=["'foo", "BAR'"])
     yield self.runStep()
コード例 #8
0
 def test_example_build_workdir_rendereable(self):
     self.setupStep(ShellMixinExample(), wantDefaultWorkdir=False)
     self.build.workdir = properties.Property("myproperty")
     self.properties.setProperty("myproperty", "/myproperty", "test")
     self.expectCommands(
         ExpectShell(workdir='/myproperty', command=['./cleanup.sh']) + 0, )
     self.expectOutcome(result=SUCCESS)
     yield self.runStep()
コード例 #9
0
 def test_description(self):
     self.setupStep(SimpleShellCommand(
         command=['foo', properties.Property('bar', 'BAR')]),
                    wantDefaultWorkdir=False)
     self.expectCommands(
         ExpectShell(workdir='build', command=['foo', 'BAR']) + 0, )
     self.expectOutcome(result=SUCCESS, state_string=u"'foo BAR'")
     yield self.runStep()
コード例 #10
0
 def test_set_properties_prop(self):
     self.setupStep(trigger.Trigger(schedulerNames=['a'],
                                    set_properties=dict(x=properties.Property('X'), y=2)))
     self.properties.setProperty('X', 'xxx', 'here')
     self.expectOutcome(result=SUCCESS)
     self.expectTriggeredWith(a=(False, [],
                                 dict(x=('xxx', 'Trigger'), y=(2, 'Trigger'))))
     return self.runStep()
コード例 #11
0
 def test_params_renderable(self):
     url = self.getURL()
     self.setupStep(http.GET(url, params=properties.Property("x")))
     self.properties.setProperty('x', {'param_1': 'param_1', 'param_2': 2}, 'here')
     self.expectLogfile('log', "URL: %s?param_1=param_1&param_2=2\nStatus: 200\n ------ Content ------\nOK" % (url, ))
     self.expectLogfile('content', "OK")
     self.expectOutcome(result=SUCCESS, state_string="Status code: 200")
     return self.runStep()
コード例 #12
0
ファイル: test_buildstep.py プロジェクト: zmadi1/buildbot
 def test_build_workdir_renderable(self):
     self.setupStep(SimpleShellCommand(command=['cmd', 'arg']),
                    wantDefaultWorkdir=False)
     self.build.workdir = properties.Property("myproperty")
     self.properties.setProperty("myproperty", "/myproperty", "test")
     self.expectCommands(
         ExpectShell(workdir='/myproperty', command=['cmd', 'arg']) + 0, )
     self.expectOutcome(result=SUCCESS)
     yield self.runStep()
コード例 #13
0
 def test_sourceStamp_prop(self):
     self.setupStep(trigger.Trigger(schedulerNames=['b'],
         sourceStamp=dict(revision=properties.Property('rev'),
             branch='dev')))
     self.properties.setProperty('rev', 602, 'me')
     expected_ss = dict(revision=602, branch='dev')
     self.expectOutcome(result=SUCCESS, status_text=['Triggered:', "'b'"])
     self.expectTriggeredWith(b=({'': expected_ss}, {'stepname': ('Trigger', 'Trigger')}, 1))
     return self.runStep()
コード例 #14
0
 def test_render(self):
     self.setupStep(worker.MakeDirectory(dir=properties.Property("x")))
     self.properties.setProperty('x', 'XXX', 'here')
     self.expectCommands(
         Expect('mkdir', {'dir': 'XXX'})
         + 0
     )
     self.expectOutcome(result=SUCCESS, state_string="Created")
     return self.runStep()
コード例 #15
0
 def test_description(self):
     self.setupStep(
         SimpleShellCommand(
             command=['foo', properties.Property('bar', 'BAR')]))
     self.expectCommands(
         ExpectShell(workdir='build', command=['foo', 'BAR']) + 0, )
     # TODO: status is only set at the step start, so BAR isn't rendered
     self.expectOutcome(result=SUCCESS, status_text=["'foo'"])
     yield self.runStep()
コード例 #16
0
 def test_alwaysUseLatest_prop(self):
     self.setupStep(
         trigger.Trigger(schedulerNames=['b'],
                         alwaysUseLatest=properties.Property('aul')))
     self.properties.setProperty('aul', False, 'me')
     self.expectOutcome(result=SUCCESS, status_text=['triggered', 'b'])
     # didn't use latest
     self.expectTriggeredWith(b=(self.THIS_SS_SETID, {}))
     return self.runStep()
コード例 #17
0
 def test_sourceStamp_prop(self):
     self.setupStep(trigger.Trigger(schedulerNames=['b'],
                                    sourceStamp=dict(revision=properties.Property('rev'),
                                                     branch='dev')))
     self.properties.setProperty('rev', 602, 'me')
     expected_ss = dict(revision=602, branch='dev')
     self.expectOutcome(result=SUCCESS)
     self.expectTriggeredWith(b=(False, [expected_ss], {}))
     return self.runStep()
コード例 #18
0
 def propertiesToPassToTriggers(self):
     return {
         'patch_id': properties.Property('patch_id'),
         'bug_id': properties.Property('bug_id'),
         'configuration': properties.Property('configuration'),
         'platform': properties.Property('platform'),
         'fullPlatform': properties.Property('fullPlatform'),
         'architecture': properties.Property('architecture'),
         'owner': properties.Property('owner'),
         'ews_revision': properties.Property('got_revision'),
     }
コード例 #19
0
 def test_set_properties_prop(self):
     self.setupStep(trigger.Trigger(schedulerNames=['a'],
             set_properties=dict(x=properties.Property('X'), y=2)))
     self.properties.setProperty('X', 'xxx', 'here')
     self.expectOutcome(result=SUCCESS, status_text=['Triggered:', "'a'"])
     self.expectTriggeredWith(a=({},
                                 dict(stepname=('Trigger', 'Trigger'),
                                      x=('xxx', 'Trigger'),
                                      y=(2, 'Trigger')), 1))
     return self.runStep()
コード例 #20
0
 def test_updateSourceStamp_prop(self):
     self.setupStep(
         trigger.Trigger(schedulerNames=['a'],
                         updateSourceStamp=properties.Property('usess')))
     self.properties.setProperty('got_revision', 23456, 'Source')
     self.properties.setProperty('usess', False, 'me')
     self.expectOutcome(result=SUCCESS, status_text=['triggered', 'a'])
     # didn't use SS
     self.expectTriggeredWith(a=(self.THIS_SS_SETID, {}))
     return self.runStep()
コード例 #21
0
 def test_example_override_workdir(self):
     # Test that makeRemoteShellCommand(workdir=X) works.
     self.setupStep(
         SimpleShellCommand(
             makeRemoteShellCommandKwargs={'workdir': '/alternate'},
             command=['foo', properties.Property('bar', 'BAR')]))
     self.expectCommands(
         ExpectShell(workdir='/alternate', command=['foo', 'BAR']) + 0, )
     self.expectOutcome(result=SUCCESS)
     yield self.runStep()
コード例 #22
0
 def test_set_properties_prop(self):
     self.setupStep(
         trigger.Trigger(schedulerNames=['a'],
                         set_properties=dict(x=properties.Property('X'),
                                             y=2)))
     self.properties.setProperty('X', 'xxx', 'here')
     self.expectOutcome(result=SUCCESS, status_text=['triggered', 'a'])
     self.expectTriggeredWith(
         a=(self.THIS_SS_SETID, dict(x=('xxx', 'Trigger'), y=(2,
                                                              'Trigger'))))
     return self.runStep()
コード例 #23
0
 def test_example_override_workdir(self):
     # Test that makeRemoteShellCommand(workdir=X) works.
     self.setupStep(
         SimpleShellCommand(
             makeRemoteShellCommandKwargs={'workdir': '/alternate'},
             command=['foo', properties.Property('bar', 'BAR')]))
     self.expectCommands(
         ExpectShell(workdir='/alternate', command=['foo', 'BAR']) + 0, )
     # TODO: status is only set at the step start, so BAR isn't rendered
     self.expectOutcome(result=SUCCESS, status_text=["'foo'"])
     yield self.runStep()
コード例 #24
0
 def test_sourceStamp_prop(self):
     self.setupStep(
         trigger.Trigger(schedulerNames=['b'],
                         sourceStamp=dict(
                             revision=properties.Property('rev'),
                             branch='dev')))
     self.properties.setProperty('rev', 602, 'me')
     self.expectOutcome(result=SUCCESS, status_text=['triggered', 'b'])
     self.expectAddedSourceStamp(revision=602, branch='dev')
     self.expectTriggeredWith(b=(self.NEW_SSID, {}))
     return self.runStep()
コード例 #25
0
    def test_createEmail_extraHeaders_one_build(self):
        _, builds = yield self.setupBuildResults(SUCCESS)
        builds[0]['properties']['hhh'] = ('vvv', 'fake')
        msgdict = create_msgdict()
        mn = yield self.setupMailNotifier('*****@*****.**', extraHeaders=dict(hhh=properties.Property('hhh')))
        # add some Unicode to detect encoding problems
        m = yield mn.createEmail(msgdict, u'builder-n\u00E5me', u'project-n\u00E5me',
                                 SUCCESS, builds)

        txt = m.as_string()
        # note that the headers *are* rendered
        self.assertIn('hhh: vvv', txt)
コード例 #26
0
 def test_alwaysUseLatest_prop_true(self):
     self.setupStep(trigger.Trigger(schedulerNames=['b'],
                                    alwaysUseLatest=properties.Property('aul')),
                    sourcestampsInBuild=[FakeSourceStamp(codebase='',
                                                         repository='x',
                                                         revision=11111)
                                         ])
     self.properties.setProperty('aul', True, 'me')
     self.expectOutcome(result=SUCCESS)
     # didn't use latest
     self.expectTriggeredWith(b=(False, [], {}))
     return self.runStep()
コード例 #27
0
 def test_alwaysUseLatest_prop_false(self):
     self.setupStep(trigger.Trigger(schedulerNames=['b'],
                                    alwaysUseLatest=properties.Property('aul')),
                    sourcestampsInBuild = [FakeSourceStamp(codebase='',
                                                           repository='x',
                                                           revision=11111)
                                           ])
     self.properties.setProperty('aul', False, 'me')
     self.expectOutcome(result=SUCCESS, status_text=['Triggered:', "'b'"])
     # didn't use latest
     self.expectTriggeredWith(b=({'': { 'codebase':'',
                                        'repository': 'x',
                                        'revision': 11111}
                                 }, {'stepname': ('Trigger', 'Trigger')}, 1))
     return self.runStep()
コード例 #28
0
 def test_alwaysUseLatest_prop_false(self):
     yield self.setup_step(trigger.Trigger(
         schedulerNames=['b'], alwaysUseLatest=properties.Property('aul')),
                           sourcestampsInBuild=[
                               FakeSourceStamp(codebase='',
                                               repository='x',
                                               revision=11111)
                           ])
     self.properties.setProperty('aul', False, 'me')
     self.expect_outcome(result=SUCCESS)
     # didn't use latest
     self.expectTriggeredWith(b=(False, [{
         'codebase': '',
         'repository': 'x',
         'revision': 11111
     }], {}))
     yield self.run_step()
コード例 #29
0
 def test_updateSourceStamp_prop_false(self):
     self.setupStep(trigger.Trigger(schedulerNames=['a'],
                            updateSourceStamp=properties.Property('usess')),
                    sourcestampsInBuild = [FakeSourceStamp(codebase='',
                                                           repository='x',
                                                           revision=11111)
                                          ],
                    gotRevisionsInBuild = {'': 23456},
                    )
     self.properties.setProperty('usess', False, 'me')
     self.expectOutcome(result=SUCCESS, status_text=['Triggered:', "'a'"])
     # didn't use got_revision
     self.expectTriggeredWith(a=({'': { 'codebase':'',
                                        'repository': 'x',
                                        'revision': 11111
                                 }}, {'stepname': ('Trigger', 'Trigger')}, 1))
     return self.runStep()
コード例 #30
0
 def test_updateSourceStamp_prop_true(self):
     self.setupStep(trigger.Trigger(schedulerNames=['a'],
                                    updateSourceStamp=properties.Property('usess')),
                    sourcestampsInBuild=[FakeSourceStamp(codebase='',
                                                         repository='x',
                                                         revision=11111)
                                         ],
                    gotRevisionsInBuild={'': 23456},
                    )
     self.properties.setProperty('usess', True, 'me')
     self.expectOutcome(result=SUCCESS)
     # didn't use got_revision
     self.expectTriggeredWith(
         a=(False,
             [{'codebase': '', 'repository': 'x', 'revision': 23456}],
             {}))
     return self.runStep()