Exemplo n.º 1
0
 def testSchedulers(self):
     s1 = scheduler.Scheduler(name='quick',
                              branch=None,
                              treeStableTimer=30,
                              builderNames=['quick'])
     s2 = scheduler.Scheduler(name="all",
                              branch=None,
                              treeStableTimer=5 * 60,
                              builderNames=["a", "b"])
     s3 = scheduler.Try_Userpass("try", ["a", "b"],
                                 port=9989,
                                 userpass=[("foo", "bar")])
     s1a = scheduler.Scheduler(name='quick',
                               branch=None,
                               treeStableTimer=30,
                               builderNames=['quick'])
     s2a = scheduler.Scheduler(name="all",
                               branch=None,
                               treeStableTimer=5 * 60,
                               builderNames=["a", "b"])
     s3a = scheduler.Try_Userpass("try", ["a", "b"],
                                  port=9989,
                                  userpass=[("foo", "bar")])
     self.failUnless(s1 == s1)
     self.failUnless(s1 == s1a)
     self.failUnless(s1a in [s1, s2, s3])
     self.failUnless(s2a in [s1, s2, s3])
     self.failUnless(s3a in [s1, s2, s3])
Exemplo n.º 2
0
    def testTryUserpass(self):
        self.basedir = "scheduler/Scheduling/TryUserpass"
        self.create_master()
        db = self.master.db
        up = [("alice", "pw1"), ("bob", "pw2")]
        s = scheduler.Try_Userpass("try2", ["a", "b"], 0, userpass=up)
        d = self.setSchedulers(s)

        def _then(ign):
            port = s.getPort()
            config = {
                'connect': 'pb',
                'username': '******',
                'passwd': 'pw1',
                'master': "localhost:%d" % port,
                'builders': ["a", "b"],
            }
            self.tryclient = t = tryclient.Try(config)
            ss = sourcestamp.SourceStamp("branch1", "123", (1, "diff"))
            t.sourcestamp = ss
            return t.deliverJob()

        d.addCallback(_then)

        def _job_delivered(ign):
            # at this point, the Try object should have a RemoteReference to
            # the status object.
            self.failUnless(self.tryclient.buildsetStatus)

        d.addCallback(_job_delivered)

        def _poll():
            return bool(db.get_active_buildset_ids())

        d.addCallback(lambda ign: self.poll(_poll, 0.1))

        def _check(ign):
            bsids = db.get_active_buildset_ids()
            (external_idstring, reason, ssid, complete, results) = \
                                db.get_buildset_info(bsids[0])
            reqs = db.get_buildrequestids_for_buildset(bsids[0])
            self.failUnlessEqual(sorted(reqs.keys()), ["a", "b"])
            s = db.getSourceStampNumberedNow(ssid)
            self.failUnlessEqual(s.branch, "branch1")
            self.failUnlessEqual(s.revision, "123")
            self.failUnlessEqual(s.patch, (1, "diff"))
            self.tryclient.cleanup()

        d.addCallback(_check)
        return d
Exemplo n.º 3
0
 def testTryUserpass(self):
     up = [("alice", "pw1"), ("bob", "pw2")]
     s = scheduler.Try_Userpass("try2", ["a", "b"], 0, userpass=up)
     self.addScheduler(s)
     port = s.getPort()
     config = {
         'connect': 'pb',
         'username': '******',
         'passwd': 'pw1',
         'master': "localhost:%d" % port,
         'builders': ["a", "b"],
     }
     t = tryclient.Try(config)
     ss = sourcestamp.SourceStamp("branch1", "123", (1, "diff"))
     t.sourcestamp = ss
     d2 = self.master.d = defer.Deferred()
     d = t.deliverJob()
     d.addCallback(self._testTryUserpass_1, t, d2)
     return d