def testGoodStep(self):
        f = BuildFactory()
        f.addStep(SetProperty(command=["echo", "value"], property="propname"))

        ss = SourceStamp()

        req = FakeBuildRequest("Testing", ss, None)

        b = f.newBuild([req])
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
    def testGoodStep(self):
        f = BuildFactory()
        f.addStep(SetProperty(command=["echo", "value"], property="propname"))

        ss = SourceStamp()

        req = FakeBuildRequest("Testing", ss, None)

        b = f.newBuild([req])
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
    def testCommand(self):
        f = BuildFactory()
        f.addStep(SetProperty(command=["echo", "value"], property="propname"))
        f.addStep(ShellCommand(command=["echo", WithProperties("%(propname)s")]))

        ss = SourceStamp()

        req = FakeBuildRequest("Testing", {ss.repository:ss}, None)

        b = f.newBuild([req])
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
    def testGoodStep(self):
        f = BuildFactory()
        f.addStep(SetPropertyFromCommand(command=["echo", "value"], property="propname"))

        ss = SourceStamp()

        req = FakeBuildRequest("Testing", {ss.repository: ss}, None)

        b = f.newBuild([req])
        b.master = mock.Mock(name='master')
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
Exemplo n.º 5
0
    def testGoodStep(self):
        f = BuildFactory()
        f.addStep(
            SetPropertyFromCommand(command=["echo", "value"],
                                   property="propname"))

        ss = SourceStamp()

        req = FakeBuildRequest("Testing", {ss.repository: ss}, None)

        b = f.newBuild([req])
        b.master = mock.Mock(name='master')
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
Exemplo n.º 6
0
    def testCommand(self):
        f = BuildFactory()
        f.addStep(SetProperty(command=["echo", "value"], property="propname"))
        f.addStep(
            ShellCommand(
                command=["echo", WithProperties("%(propname)s")]))

        ss = SourceStamp()

        req = FakeBuildRequest("Testing", {ss.repository: ss}, None)

        b = f.newBuild([req])
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
    def testGoodStep(self):
        f = BuildFactory()
        f.addStep(SetPropertyFromCommand(command=["echo", "value"], property="propname"))

        ss = mock.Mock(name="sourcestamp")
        ss.repository = 'repo'
        ss.changes = []
        ss.patch = ss.patch_info = None

        req = FakeBuildRequest("Testing", {ss.repository: ss}, None)

        b = f.newBuild([req])
        b.master = mock.Mock(name='master')
        b.build_status = FakeBuildStatus()
        b.workerforbuilder = FakeWorkerForBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
    def testCommand(self):
        f = BuildFactory()
        f.addStep(SetPropertyFromCommand(command=["echo", "value"], property="propname"))
        f.addStep(ShellCommand(command=["echo", WithProperties("%(propname)s")]))

        ss = mock.Mock(name="sourcestamp")
        ss.repository = "repo"
        ss.changes = []
        ss.patch = ss.patch_info = None

        req = FakeBuildRequest("Testing", {ss.repository: ss}, None)

        b = f.newBuild([req])
        b.master = mock.Mock(name="master")
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
    def newBuild(self, requests):
        clone = copy.copy(self.me_)
        clone.bb_requests = requests
        assert clone.factorySteps is None
        clone.factorySteps = []
        clone.onNewBuild()

        class BuildWrapper(Build):

            def __init__(self, *args, **kwargs):
                self.me_ = clone
                clone.bb_build = self
                Build.__init__(self, *args, **kwargs);


            def run(self):
                self.me_.steps = self.steps
                return self.me_.run_()


            def runCleanup(self):
                return self.me_.runCleanup()


        self.buildClass = BuildWrapper

        self.workdir = clone.workdir
        self.steps = []
        if clone.factorySteps:
            for step in clone.factorySteps:
                assert step._step_status is None, "Step was already used. Don\'t create steps during initConstants() call!"
                self.steps.append(_BuildStepDummyFactory(step))
        clone.factorySteps = None

        b = BuildFactory.newBuild(self, requests)
        return b
Exemplo n.º 10
0
    def newBuild(self, request):
        """Create a new build.

        The steps are created here, instead of the __init__, since we want to
        change them, potentially at each builds: each time a build is triggered,
        we want to discover all the latest components in the specified MMF, and
        to clone them, and to build and test accordingly to those components.

        Notice that:

            * the steps are cleared at the beginning of the method
            * we call the parent method at the end of the tests to create the
              real Build object, as normally do by the Buildbot
        """

        self.steps = []

        buildout_file = 'buildout-test.cfg'
        entry_component_url = self.git_base_url + '/' + self.entry_component

        self.addStep(PgSafeStopSb())
        self.addStep(CleanUp())
        self.addStep(CreateSandbox())
        self.addStep(Clone(entry_component_url, 'pkg'))
        self.addStep(BootstrapSb())

        # Change the working directory of the next build steps
        wd = os.path.join(self.workdir, "pkg")

        # XXXjballet: we should find a way to call this without changing the
        # path here
        # Maybe we should create a real Python component for this code, and add
        # a dependency on it?
        import sys
        sys.path.append('/srv/fabric')
        import vsonde

        # XXXjballet: note that the call to vsonde.check_mmf() is blocking and
        # might block the whole Twisted process for a while. It means that when
        # a build is launched, the whole Buildbot process can be freezed,
        # waiting for the call to finish, and the GUI or other builds in the
        # same process will freeze as well.
        # Hopefully, we don't have many MMF at the same time, and the call to
        # check_mmf() lasts only a 4-5 seconds at most.
        dests = []
        for name in vsonde.check_mmf(self.mmf_name, self.git_base_dir):
            component = self.git_base_url + '/' + name
            dest = os.path.basename(component)
            self.addStep(Clone(component, dest, self.mmf_name, workdir=wd))
            dests.append(dest)

        self.addStep(SetDevelopProperty(dests, workdir=wd))

        # This is intepreted by the shell, be sure to protect special characters
        # like "$"!
        buildout_content = dedent("""
            [buildout]
            extends = buildout.cfg
            develop = .
              %(develops)s

            parts += postgresql
                     test
                     compattest

            [compattest]
            runner-environment = environment-localpg

            [test]
            environment = environment-localpg

            [probe-conf]
            conf-db-uri = config.db
            z3-log-uri = z3.log
            supervisord-log-uri = supervisord.log
            """)

        self.addStep(CreateFile(buildout_file, buildout_content, workdir=wd))
        self.addStep(Buildout(cmd_args=["-c", buildout_file, '-U']))
        self.addStep(ShowEggInTest())
        self.addStep(PgStartSb())
        self.addStep(Compattest(haltOnFailure=False))
        self.addStep(Test(haltOnFailure=False))
        self.addStep(PgStopSb())

        return BuildFactory.newBuild(self, request)