Example #1
0
    def test_mode_full_clean_different_project(self):
        self.setup_step(
            gerrit.Gerrit(repourl='http://github.com/buildbot/buildbot.git',
                          mode='full',
                          method='clean',
                          codebase='buildbot'))
        self.build.setProperty("event.change.project", "buildbot")
        self.sourcestamp.project = 'not_buildbot'
        self.build.setProperty("gerrit_change", "1234/567")

        self.expect_commands(
            ExpectShell(workdir='wkdir',
                        command=['git', '--version'
                                 ]).stdout('git version 1.7.5').exit(0),
            ExpectStat(file='wkdir/.buildbot-patched',
                       log_environ=True).exit(1),
            ExpectListdir(dir='wkdir').files(['.git']).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['git', 'clean', '-f', '-f', '-d']).exit(0),
            ExpectShell(workdir='wkdir',
                        command=[
                            'git', 'fetch', '-f', '-t',
                            'http://github.com/buildbot/buildbot.git', 'HEAD',
                            '--progress'
                        ]).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['git', 'checkout', '-f',
                                 'FETCH_HEAD']).exit(0),
            ExpectShell(workdir='wkdir', command=[
                'git', 'rev-parse', 'HEAD'
            ]).stdout('f6ad368298bd941e934a41f3babc827b2aa95a1d').exit(0))
        self.expect_outcome(result=SUCCESS)
        return self.run_step()
Example #2
0
    def test_mode_full_clean_force_same_project(self):
        self.setupStep(
            gerrit.Gerrit(repourl='http://github.com/buildbot/buildbot.git',
                          mode='full',
                          method='clean',
                          codebase='buildbot'))
        self.build.setProperty("event.change.project", "buildbot")
        self.sourcestamp.project = 'buildbot'
        self.build.setProperty("gerrit_change", "1234/567")

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['git', '--version']) +
            ExpectShell.log('stdio', stdout='git version 1.7.5') + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('listdir', {
                'dir': 'wkdir',
                'logEnviron': True,
                'timeout': 1200
            }) + Expect.update('files', ['.git']) + 0,
            ExpectShell(workdir='wkdir',
                        command=['git', 'clean', '-f', '-f', '-d']) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'git', 'fetch', '-f', '-t',
                            'http://github.com/buildbot/buildbot.git',
                            'refs/changes/34/1234/567', '--progress'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['git', 'reset', '--hard', 'FETCH_HEAD', '--'
                                 ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'git', 'checkout', '-B', 'refs/changes/34/1234/567'
                        ]) + 0,
            ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'HEAD'])
            + ExpectShell.log(
                'stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') +
            0,
        )
        self.expectOutcome(result=SUCCESS)
        self.expectProperty(
            'got_revision',
            {'buildbot': 'f6ad368298bd941e934a41f3babc827b2aa95a1d'}, 'Gerrit')
        return self.runStep()
Example #3
0
    def test_mode_full_clean(self):
        self.setupStep(
            gerrit.Gerrit(repourl='http://github.com/buildbot/buildbot.git',
                          mode='full',
                          method='clean'))
        self.build.setProperty("event.patchSet.ref", "gerrit_branch")

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['git', '--version']) +
            ExpectShell.log('stdio', stdout='git version 1.7.5') + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('listdir', {
                'dir': 'wkdir',
                'logEnviron': True,
                'timeout': 1200
            }) + Expect.update('files', ['.git']) + 0,
            ExpectShell(workdir='wkdir',
                        command=['git', 'clean', '-f', '-f', '-d']) + 0,
            ExpectShell(
                workdir='wkdir',
                command=[
                    'git', 'fetch', '-t',
                    'http://github.com/buildbot/buildbot.git', 'gerrit_branch'
                ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['git', 'reset', '--hard', 'FETCH_HEAD', '--'
                                 ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['git', 'branch', '-M', 'gerrit_branch']) + 0,
            ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'HEAD'])
            + ExpectShell.log(
                'stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') +
            0,
        )
        self.expectOutcome(result=SUCCESS)
        self.expectProperty('got_revision',
                            'f6ad368298bd941e934a41f3babc827b2aa95a1d',
                            'Gerrit')
        return self.runStep()
Example #4
0
    def test_mode_full_clean_force_build(self):
        self.setupStep(
            gerrit.Gerrit(repourl='http://github.com/buildbot/buildbot.git',
                          mode='full',
                          method='clean'))
        self.build.setProperty("gerrit_change", "1234/567")

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['git', '--version']) +
            ExpectShell.log('stdio', stdout='git version 1.7.5') + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('stat', dict(file='wkdir/.git', logEnviron=True)) + 0,
            ExpectShell(workdir='wkdir',
                        command=['git', 'clean', '-f', '-f', '-d']) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'git', 'fetch', '-t',
                            'http://github.com/buildbot/buildbot.git',
                            'refs/changes/34/1234/567'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['git', 'reset', '--hard', 'FETCH_HEAD', '--'
                                 ]) + 0,
            ExpectShell(
                workdir='wkdir',
                command=['git', 'branch', '-M', 'refs/changes/34/1234/567']) +
            0,
            ExpectShell(workdir='wkdir', command=['git', 'rev-parse', 'HEAD'])
            + ExpectShell.log(
                'stdio', stdout='f6ad368298bd941e934a41f3babc827b2aa95a1d') +
            0,
        )
        self.expectOutcome(result=SUCCESS, status_text=["update"])
        self.expectProperty('got_revision',
                            'f6ad368298bd941e934a41f3babc827b2aa95a1d',
                            'Gerrit')
        return self.runStep()