コード例 #1
0
    def testRestart(self):
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)

        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)

        restartJobId = self.discardOutput(helper.restartJob, jobId)
        assert (restartJobId != jobId)
        helper.waitForJob(restartJobId)
        job = helper.getJob(jobId)
        restartJob = helper.getJob(restartJobId)
        assert (restartJob.isBuilt())
        assert (set(job.iterTroves().next().getBinaryTroves()) == set(
            restartJob.iterTroves().next().getBinaryTroves()))
        fixtures.updateBuiltJob1(self)
        self.addComponent('simple:source', '1',
                          [('simple.recipe', recipes.simpleRecipe)])
        restartJobId2 = self.discardOutput(helper.restartJob, restartJobId,
                                           ['simple'])
        helper.waitForJob(restartJobId2)
        restartJob2 = helper.getJob(restartJobId2)
        trovesByName = dict((x.getName(), x) for x in restartJob2.iterTroves())
        assert (set(trovesByName) == set(['testcase:source', 'simple:source']))
        assert (set(trovesByName['testcase:source'].getBinaryTroves()) != set(
            restartJob.iterTroves().next().getBinaryTroves()))
コード例 #2
0
ファイル: restarttest.py プロジェクト: fedora-conary/rmake-2
    def testRestart(self):
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)

        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)

        restartJobId = self.discardOutput(helper.restartJob, jobId)
        assert(restartJobId != jobId)
        helper.waitForJob(restartJobId)
        job = helper.getJob(jobId)
        restartJob = helper.getJob(restartJobId)
        assert(restartJob.isBuilt())
        assert(set(job.iterTroves().next().getBinaryTroves()) 
                == set(restartJob.iterTroves().next().getBinaryTroves()))
        fixtures.updateBuiltJob1(self)
        self.addComponent('simple:source', '1', [('simple.recipe',
                                                  recipes.simpleRecipe)])
        restartJobId2 = self.discardOutput(helper.restartJob, restartJobId, 
                                           ['simple'])
        helper.waitForJob(restartJobId2)
        restartJob2 = helper.getJob(restartJobId2)
        trovesByName = dict((x.getName(), x) for x in restartJob2.iterTroves())
        assert(set(trovesByName) == set(['testcase:source', 'simple:source']))
        assert(set(trovesByName['testcase:source'].getBinaryTroves())
                != set(restartJob.iterTroves().next().getBinaryTroves()))
コード例 #3
0
ファイル: committest.py プロジェクト: fedora-conary/rmake-2
 def testCommitToFile(self):
     self.openRepository()
     self.openRmakeRepository()
     jobId = fixtures.addBuiltJob1(self)
     client = self.startRmakeServer()
     helper = self.getRmakeHelper(client.uri)
     changesetPath = self.workDir + '/commit.ccs'
     rc, txt = self.captureOutput(helper.commitJob, jobId,
                                  writeToFile=changesetPath)
     cs = changeset.ChangeSetFromFile(changesetPath)
     for trvCs in cs.iterNewTroveList():
         assert(trvCs.getNewVersion().getHost() == 'localhost')
コード例 #4
0
 def testCommitToFile(self):
     self.openRepository()
     self.openRmakeRepository()
     jobId = fixtures.addBuiltJob1(self)
     client = self.startRmakeServer()
     helper = self.getRmakeHelper(client.uri)
     changesetPath = self.workDir + '/commit.ccs'
     rc, txt = self.captureOutput(helper.commitJob,
                                  jobId,
                                  writeToFile=changesetPath)
     cs = changeset.ChangeSetFromFile(changesetPath)
     for trvCs in cs.iterNewTroveList():
         assert (trvCs.getNewVersion().getHost() == 'localhost')
コード例 #5
0
ファイル: restarttest.py プロジェクト: fedora-conary/rmake-2
 def testRestartUpdatesResolveTroves(self):
     self.openRmakeRepository()
     jobId = fixtures.addBuiltJob1(self)
     client = self.startRmakeServer()
     helper = self.getRmakeHelper(client.uri)
     # update the resolveTrove item: buildReq.
     # make sure that restart finds the new version.
     buildReq = fixtures.updateBuiltJob1BuildReq(self)
     mock.mockMethod(helper.client.buildJob)
     self.discardOutput(helper.restartJob, jobId)
     (job,), kw = helper.client.buildJob._mock.popCall()
     assert(job.getMainConfig().resolveTroveTups
             == [[buildReq.getNameVersionFlavor()]])
コード例 #6
0
 def testRestartUpdatesResolveTroves(self):
     self.openRmakeRepository()
     jobId = fixtures.addBuiltJob1(self)
     client = self.startRmakeServer()
     helper = self.getRmakeHelper(client.uri)
     # update the resolveTrove item: buildReq.
     # make sure that restart finds the new version.
     buildReq = fixtures.updateBuiltJob1BuildReq(self)
     mock.mockMethod(helper.client.buildJob)
     self.discardOutput(helper.restartJob, jobId)
     (job, ), kw = helper.client.buildJob._mock.popCall()
     assert (job.getMainConfig().resolveTroveTups == [[
         buildReq.getNameVersionFlavor()
     ]])
コード例 #7
0
ファイル: restarttest.py プロジェクト: fedora-conary/rmake-2
    def testRestartDeleteThenRestart(self):
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)

        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)
        restartJobId = self.discardOutput(helper.restartJob, jobId)
        assert(restartJobId != jobId)
        restartJobId2 = self.discardOutput(helper.restartJob, restartJobId)
        assert(helper.client.getJob(restartJobId2, withConfigs=True).getMainConfig().jobContext == [jobId, restartJobId])
        helper.deleteJobs([jobId])
        assert(helper.client.getJob(restartJobId2, withConfigs=True).getMainConfig().jobContext == [restartJobId])
        restartJobId3 = self.discardOutput(helper.restartJob, restartJobId2)
        helper.waitForJob(restartJobId3)
コード例 #8
0
ファイル: restarttest.py プロジェクト: fedora-conary/rmake-2
    def testRemoveThenRestart(self):
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)
        self.markRemoved('testcase:source')
        self.addComponent('simple:source')
        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)

        mock.mockMethod(helper.client.buildJob)
        restartJobId = self.discardOutput(helper.restartJob, jobId,
                                          ['simple:source'], 
                                          clearBuildList=True)
        args, kw = helper.client.buildJob._mock.popCall()
        troveTup, = list(args[0].iterTroveList())
        assert(troveTup[0] == 'simple:source')
コード例 #9
0
    def testRemoveThenRestart(self):
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)
        self.markRemoved('testcase:source')
        self.addComponent('simple:source')
        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)

        mock.mockMethod(helper.client.buildJob)
        restartJobId = self.discardOutput(helper.restartJob,
                                          jobId, ['simple:source'],
                                          clearBuildList=True)
        args, kw = helper.client.buildJob._mock.popCall()
        troveTup, = list(args[0].iterTroveList())
        assert (troveTup[0] == 'simple:source')
コード例 #10
0
ファイル: restarttest.py プロジェクト: pombreda/rmake-2
    def testRestart(self):
        self.openRepository()
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)
        db = self.openRmakeDatabase()
        job = db.getJob(jobId)
        logPath = job.troves.values()[0].logPath
        jobContext = [jobId]
        restartJob = self.getRestartJob(job)
        b = builder.Builder(self.rmakeCfg, restartJob, jobContext, db)
        b.initializeBuild()
        trove = restartJob.iterTroves().next()
        assert (trove.isPrebuilt())
        b.build()
        assert (restartJob.isBuilt())
        assert (trove.isBuilt())
        assert (logPath == restartJob.troves.values()[0].logPath)

        # update the source and make sure it needs a rebuild
        fixtures.updateBuiltJob1(self)
        restartJob = self.getRestartJob(job)
        b = builder.Builder(self.rmakeCfg, restartJob, jobContext, db)
        b.initializeBuild()
        trove = restartJob.iterTroves().next()
        assert (not trove.isPrebuilt())
        b.build()
        assert (restartJob.isBuilt())
        assert (trove.isBuilt())
        assert (logPath != restartJob.troves.values()[0].logPath)

        buildReqRun = self.addComponent('buildreq:runtime', '2', ['/buildreq'])
        buildReq = self.addCollection('buildreq', '2', [':runtime'])

        # now update build req - that should start out as prebuilt
        # but in the end it should create new binaries not existing before.
        jobContext = [restartJob.jobId]
        restartJob2 = self.getRestartJob(restartJob)
        b = builder.Builder(self.rmakeCfg, restartJob2, jobContext, db)
        b.initializeBuild()
        trove2 = restartJob2.iterTroves().next()
        assert (trove2.isPrebuilt())
        b.dh.updateBuildableTroves()
        assert (trove2.isBuildable())
コード例 #11
0
ファイル: committest.py プロジェクト: fedora-conary/rmake-2
 def testCommitSameJobTwice(self):
     self.openRepository()
     self.openRmakeRepository()
     jobId = fixtures.addBuiltJob1(self)
     client = self.startRmakeServer()
     helper = self.getRmakeHelper(client.uri)
     rc, txt = self.captureOutput(helper.commitJob, jobId)
     rc, txt = self.captureOutput(helper.commitJob, jobId)
     assert(txt == 'error: Job(s) already committed\n')
     job = helper.getJob(jobId)
     assert(job.isCommitted())
     # make sure you don't recommit when the job has already been committed.
     jobId = self.discardOutput(helper.restartJob, job.jobId)
     helper.waitForJob(jobId)
     job = helper.getJob(jobId)
     assert(not job.isFailed())
     self.logFilter.add()
     assert(helper.commitJob(jobId))
     self.logFilter.compare(['warning: All built troves have already been committed'])
コード例 #12
0
    def testRestartDeleteThenRestart(self):
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)

        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)
        restartJobId = self.discardOutput(helper.restartJob, jobId)
        assert (restartJobId != jobId)
        restartJobId2 = self.discardOutput(helper.restartJob, restartJobId)
        assert (helper.client.getJob(
            restartJobId2, withConfigs=True).getMainConfig().jobContext == [
                jobId, restartJobId
            ])
        helper.deleteJobs([jobId])
        assert (helper.client.getJob(
            restartJobId2,
            withConfigs=True).getMainConfig().jobContext == [restartJobId])
        restartJobId3 = self.discardOutput(helper.restartJob, restartJobId2)
        helper.waitForJob(restartJobId3)
コード例 #13
0
ファイル: restarttest.py プロジェクト: fedora-conary/rmake-2
    def testRestart(self):
        self.openRepository()
        self.openRmakeRepository()
        jobId = fixtures.addBuiltJob1(self)
        db = self.openRmakeDatabase()
        job = db.getJob(jobId)
        logPath = job.troves.values()[0].logPath
        jobContext = [jobId]
        restartJob = self.getRestartJob(job)
        b = builder.Builder(self.rmakeCfg, restartJob, jobContext, db)
        b.initializeBuild()
        trove = restartJob.iterTroves().next()
        assert(trove.isPrebuilt())
        b.build()
        assert(restartJob.isBuilt())
        assert(trove.isBuilt())
        assert(logPath == restartJob.troves.values()[0].logPath)

        # update the source and make sure it needs a rebuild
        fixtures.updateBuiltJob1(self)
        restartJob = self.getRestartJob(job)
        b = builder.Builder(self.rmakeCfg, restartJob, jobContext, db)
        b.initializeBuild()
        trove = restartJob.iterTroves().next()
        assert(not trove.isPrebuilt())
        b.build()
        assert(restartJob.isBuilt())
        assert(trove.isBuilt())
        assert(logPath != restartJob.troves.values()[0].logPath)

        buildReqRun = self.addComponent('buildreq:runtime', '2', ['/buildreq'])
        buildReq = self.addCollection('buildreq', '2', [':runtime'])

        # now update build req - that should start out as prebuilt
        # but in the end it should create new binaries not existing before.
        jobContext = [restartJob.jobId]
        restartJob2 = self.getRestartJob(restartJob)
        b = builder.Builder(self.rmakeCfg, restartJob2, jobContext, db)
        b.initializeBuild()
        trove2 = restartJob2.iterTroves().next()
        assert(trove2.isPrebuilt())
        b.dh.updateBuildableTroves()
        assert(trove2.isBuildable())
コード例 #14
0
 def testCommitSameJobTwice(self):
     self.openRepository()
     self.openRmakeRepository()
     jobId = fixtures.addBuiltJob1(self)
     client = self.startRmakeServer()
     helper = self.getRmakeHelper(client.uri)
     rc, txt = self.captureOutput(helper.commitJob, jobId)
     rc, txt = self.captureOutput(helper.commitJob, jobId)
     assert (txt == 'error: Job(s) already committed\n')
     job = helper.getJob(jobId)
     assert (job.isCommitted())
     # make sure you don't recommit when the job has already been committed.
     jobId = self.discardOutput(helper.restartJob, job.jobId)
     helper.waitForJob(jobId)
     job = helper.getJob(jobId)
     assert (not job.isFailed())
     self.logFilter.add()
     assert (helper.commitJob(jobId))
     self.logFilter.compare(
         ['warning: All built troves have already been committed'])
コード例 #15
0
ファイル: committest.py プロジェクト: fedora-conary/rmake-2
    def testCommitTwoJobs(self):
        self.openRmakeRepository()
        db = self.openRmakeDatabase()
        jobId1 = fixtures.addBuiltJob1(self)
        jobId2 = fixtures.addBuiltJob2(self)

        repos = self.openRepository()
        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)
        passed, txt = self.commitJobs(helper, [jobId1, jobId2])
        assert(passed)
        self.assertEquals(txt, """
Committed job 1:
    testcase:source=/localhost@rpl:linux/1-1[ssl %s] ->
       testcase=/localhost@rpl:linux/1-1-1[ssl]


Committed job 2:
    testcase2:source=/localhost@rpl:linux/1-1[%s] ->
       testcase2=/localhost@rpl:linux/1-1-1[]

""" % (self.getArchFlavor(), self.getArchFlavor()))
コード例 #16
0
    def testCommitTwoJobs(self):
        self.openRmakeRepository()
        db = self.openRmakeDatabase()
        jobId1 = fixtures.addBuiltJob1(self)
        jobId2 = fixtures.addBuiltJob2(self)

        repos = self.openRepository()
        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)
        passed, txt = self.commitJobs(helper, [jobId1, jobId2])
        assert (passed)
        self.assertEquals(
            txt, """
Committed job 1:
    testcase:source=/localhost@rpl:linux/1-1[ssl %s] ->
       testcase=/localhost@rpl:linux/1-1-1[ssl]


Committed job 2:
    testcase2:source=/localhost@rpl:linux/1-1[%s] ->
       testcase2=/localhost@rpl:linux/1-1-1[]

""" % (self.getArchFlavor(), self.getArchFlavor()))
コード例 #17
0
ファイル: buildtest.py プロジェクト: pombreda/rmake-2
    def testBuildInfo(self):
        self.addComponent('bar:runtime')
        self.addComponent('foo:source')
        self.openRepository()
        self.openRmakeRepository()
        self.buildCfg.flavor = [deps.parseFlavor('is:x86')]
        self.buildCfg.configLine('resolveTroves bar:runtime')
        self.buildCfg.configLine('[nossl]')
        self.buildCfg.configLine('flavor !ssl is: x86')
        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)
        rc, txt = self.captureOutput(helper.buildTroves,
                                     ['foo{nossl}', 'foo[ssl]'],
                                     infoOnly=True,
                                     limitToLabels='localhost@rpl:linux')
        txt = re.sub('flavor.*', 'flavor <flavor>', txt)
        txt = re.sub('buildFlavor .*', 'buildFlavor <flavor>', txt)
        assert ('repositoryMap' in txt)
        txt = re.sub('repositoryMap .*?\n', '', txt)
        self.assertEquals(
            txt, '''
{Default Context}

ResolveTroves:

bar:runtime=/localhost@rpl:linux/1.0-1-1[]

Configuration:
copyInConfig              False
copyInConary              False
buildFlavor <flavor>
flavor <flavor>
installLabelPath          localhost@rpl:linux
resolveTrovesOnly         False
user                      rmakehost rmake <password>
user                      * test <password>

Building:
foo:source=localhost@rpl:linux/1.0-1[ssl]

{nossl}

ResolveTroves:

bar:runtime=/localhost@rpl:linux/1.0-1-1[]

Configuration:
buildFlavor <flavor>
flavor <flavor>
installLabelPath          localhost@rpl:linux
resolveTrovesOnly         False
user                      rmakehost rmake <password>
user                      * test <password>

Building:
foo:source=localhost@rpl:linux/1.0-1{nossl}
''')

        rc, txt = self.captureOutput(helper.buildTroves,
                                     ['foo{nossl}', 'foo[ssl]'],
                                     quiet=True,
                                     infoOnly=True)
        self.assertEquals(
            txt, '''\
foo:source=localhost@rpl:linux/1.0-1[ssl]
foo:source=localhost@rpl:linux/1.0-1{nossl}
''')
        job = fixtures.addBuiltJob1(self)
        rc, txt = self.captureOutput(helper.restartJob,
                                     1,
                                     infoOnly=True,
                                     quiet=True)
        self.assertEquals(
            txt, '''\
testcase:source=localhost@rpl:linux/1-1[ssl]
''')
コード例 #18
0
ファイル: buildtest.py プロジェクト: fedora-conary/rmake-2
    def testBuildInfo(self):
        self.addComponent('bar:runtime')
        self.addComponent('foo:source')
        self.openRepository()
        self.openRmakeRepository()
        self.buildCfg.flavor = [deps.parseFlavor('is:x86')]
        self.buildCfg.configLine('resolveTroves bar:runtime')
        self.buildCfg.configLine('[nossl]')
        self.buildCfg.configLine('flavor !ssl is: x86')
        client = self.startRmakeServer()
        helper = self.getRmakeHelper(client.uri)
        rc, txt = self.captureOutput(helper.buildTroves,['foo{nossl}', 'foo[ssl]'], infoOnly=True, limitToLabels='localhost@rpl:linux')
        txt = re.sub('flavor.*', 'flavor <flavor>', txt)
        txt = re.sub('buildFlavor .*', 'buildFlavor <flavor>', txt)
        assert('repositoryMap' in txt)
        txt = re.sub('repositoryMap .*?\n', '', txt)
        self.assertEquals(txt, '''
{Default Context}

ResolveTroves:

bar:runtime=/localhost@rpl:linux/1.0-1-1[]

Configuration:
copyInConfig              False
copyInConary              False
buildFlavor <flavor>
flavor <flavor>
installLabelPath          localhost@rpl:linux
resolveTrovesOnly         False
user                      rmakehost rmake <password>
user                      * test <password>

Building:
foo:source=localhost@rpl:linux/1.0-1[ssl]

{nossl}

ResolveTroves:

bar:runtime=/localhost@rpl:linux/1.0-1-1[]

Configuration:
buildFlavor <flavor>
flavor <flavor>
installLabelPath          localhost@rpl:linux
resolveTrovesOnly         False
user                      rmakehost rmake <password>
user                      * test <password>

Building:
foo:source=localhost@rpl:linux/1.0-1{nossl}
''')

        rc, txt = self.captureOutput(helper.buildTroves,['foo{nossl}', 'foo[ssl]'], quiet=True, infoOnly=True)
        self.assertEquals(txt, '''\
foo:source=localhost@rpl:linux/1.0-1[ssl]
foo:source=localhost@rpl:linux/1.0-1{nossl}
''')
        job = fixtures.addBuiltJob1(self)
        rc, txt = self.captureOutput(helper.restartJob, 1, infoOnly=True,
                                     quiet=True)
        self.assertEquals(txt, '''\
testcase:source=localhost@rpl:linux/1-1[ssl]
''')