def test_FulfillUpsetoRequirements(self): localRequiringProject = gitwrapper.LocalClone(self.requiringProject) localClone1 = gitwrapper.LocalClone(self.project1) localClone1.writeFile("build/product1", "product1 contents") solventwrapper.upseto(localRequiringProject, "fulfillRequirements") localRequiringProject.writeFile("build/product2", "product2 contents") solventwrapper.configureAsOfficial() solventwrapper.run(localRequiringProject, "submitbuild") solventwrapper.run(localRequiringProject, "approve") solventwrapper.configureAsNonOfficial() self.cleanLocalClonesDir() localRecursiveProject = gitwrapper.LocalClone(self.recursiveProject) solventwrapper.run(localRecursiveProject, "checkrequirements") solventwrapper.run(localRecursiveProject, "fulfillrequirements") self.assertTrue(localClone1.fileExists("build/product1")) self.assertTrue(localRequiringProject.fileExists("build/product2")) solventwrapper.run(localRecursiveProject, "checkrequirements") labels = self.osmosisPair.local.client().listLabels() self.assertEquals(len(labels), 1) label = labels[0] self.osmosisPair.local.client().eraseLabel(label) solventwrapper.run(localRecursiveProject, "checkrequirements") self.osmosisPair.official.client().eraseLabel(label) solventwrapper.runShouldFail(localRecursiveProject, "checkrequirements", "label")
def test_priorityBetweenStates_OfficialBuild(self): created = self.createAllStates() solventwrapper.configureAsOfficial() self.assertEquals(created['getCleanLabel'](), created['officialLabel']) self.osmosisPair.local.client().eraseLabel(created['officialLabel']) self.assertEquals(created['getCleanLabel'](), created['officialLabel']) self.osmosisPair.official.client().eraseLabel(created['officialLabel']) created['noCleanLabel']()
def test_ApproveTwiceDoesNotWork_ForceDoesNothing(self): localClone1 = gitwrapper.LocalClone(self.project1) solventwrapper.configureAsOfficial() solventwrapper.run(localClone1, "submitbuild") solventwrapper.run(localClone1, "approve") solventwrapper.runShouldFail(localClone1, "approve", "already") solventwrapper.runShouldFail(localClone1, "approve", "already", env=dict(SOLVENT_CONFIG="FORCE: yes"))
def createBuildProduct(self): self.producer = gitwrapper.GitHub("producer") localProducer = gitwrapper.LocalClone(self.producer) localProducer.writeFile("build/theDirectory/theProduct", "the contents") solventwrapper.configureAsOfficial() solventwrapper.run(localProducer, "submitproduct theProductName build") self.assertEquals(len(self.osmosisPair.local.client().listLabels()), 1) label = 'solvent__producer__theProductName__%s__officialcandidate' % self.producer.hash( ) self.assertEquals(self.osmosisPair.local.client().listLabels(), [label]) self.assertEquals(len(self.osmosisPair.official.client().listLabels()), 1) solventwrapper.run(localProducer, "approve --product=theProductName") return localProducer
def test_FulfillUpsetoRequirements_NoOfficialBuild(self): localClone1 = gitwrapper.LocalClone(self.project1) localClone1.writeFile("build/product1", "product1 contents") solventwrapper.configureAsOfficial() solventwrapper.run(localClone1, "submitbuild") self.cleanLocalClonesDir() localClone2 = gitwrapper.LocalClone(self.project2) localClone2.writeFile("build/product2", "product2 contents") solventwrapper.run(localClone2, "submitbuild") solventwrapper.run(localClone2, "approve") solventwrapper.configureAsNonOfficial() self.cleanLocalClonesDir() localRequiringProject = gitwrapper.LocalClone(self.requiringProject) solventwrapper.runShouldFail(localRequiringProject, "fulfillrequirements", "build")
def test_noOfficialObjectStoreConfigured(self): localRequiringProject = gitwrapper.LocalClone(self.requiringProject) localClone1 = gitwrapper.LocalClone(self.project1) localClone1.writeFile("build/product1", "product1 contents") solventwrapper.upseto(localRequiringProject, "fulfillRequirements") localRequiringProject.writeFile("build/product2", "product2 contents") solventwrapper.configureNoOfficial() solventwrapper.configureAsOfficial() solventwrapper.run(localRequiringProject, "submitbuild") solventwrapper.run(localRequiringProject, "approve") self.cleanLocalClonesDir() localRecursiveProject = gitwrapper.LocalClone(self.recursiveProject) solventwrapper.run(localRecursiveProject, "fulfillrequirements") self.assertTrue(localClone1.fileExists("build/product1")) self.assertTrue(localRequiringProject.fileExists("build/product2"))
def test_FulfillUpsetoRequirements_MoreThanOneProject(self): localClone1 = gitwrapper.LocalClone(self.project1) localClone1.writeFile("build/product1", "product1 contents") solventwrapper.configureAsOfficial() solventwrapper.run(localClone1, "submitbuild") solventwrapper.run(localClone1, "approve") self.cleanLocalClonesDir() localClone2 = gitwrapper.LocalClone(self.project2) localClone2.writeFile("build/product2", "product2 contents") solventwrapper.run(localClone2, "submitbuild") solventwrapper.run(localClone2, "approve") solventwrapper.configureAsNonOfficial() self.cleanLocalClonesDir() localRequiringProject = gitwrapper.LocalClone(self.requiringProject) solventwrapper.run(localRequiringProject, "fulfillrequirements") self.assertTrue(localClone1.fileExists("build/product1")) self.assertTrue(localClone2.fileExists("build/product2"))
def test_SubmitANonUpsetoedProjectOfficialBuild(self): localClone1 = gitwrapper.LocalClone(self.project1) hash = localClone1.hash() localClone1.writeFile("build/product1", "product1 contents") solventwrapper.configureAsOfficial() solventwrapper.run(localClone1, "submitbuild") self.assertEquals(len(self.osmosisPair.local.client().listLabels()), 1) label = 'solvent__project1__build__%s__officialcandidate' % hash self.assertEquals(self.osmosisPair.local.client().listLabels(), [label]) self.assertEquals(len(self.osmosisPair.official.client().listLabels()), 1) self.assertEquals(self.osmosisPair.official.client().listLabels(), [label]) self.cleanLocalClonesDir() self.osmosisPair.local.client().checkout( path=gitwrapper.localClonesDir(), label=label) self.assertEquals(localClone1.hash(), hash) self.assertTrue(localClone1.fileExists("build/product1"))
def test_unsubmit_official(self): self.producer = gitwrapper.GitHub("producer") localProducer = gitwrapper.LocalClone(self.producer) localProducer.writeFile("build/theDirectory/theProduct", "the contents") solventwrapper.configureAsOfficial() solventwrapper.run(localProducer, "submitbuild") solventwrapper.run(localProducer, "submitproduct theProductName build") self.assertEquals(len(self.osmosisPair.local.client().listLabels()), 2) self.assertEquals(len(self.osmosisPair.official.client().listLabels()), 2) label = 'solvent__producer__theProductName__%s__officialcandidate' % self.producer.hash( ) self.assertIn(label, self.osmosisPair.local.client().listLabels()) label = 'solvent__producer__build__%s__officialcandidate' % self.producer.hash( ) self.assertIn(label, self.osmosisPair.local.client().listLabels()) solventwrapper.run(localProducer, "unsubmit") self.assertEquals(len(self.osmosisPair.official.client().listLabels()), 0) self.assertEquals(len(self.osmosisPair.local.client().listLabels()), 0)