def testUpgradeMaster(self): # first, create a master, run it briefly, then upgrade it. Nothing # should change. basedir = "test_runner.master2" options = runner.MasterOptions() options.parseOptions(["-q", basedir]) cwd = os.getcwd() runner.createMaster(options) os.chdir(cwd) f = open(os.path.join(basedir, "master.cfg"), "w") f.write(open(os.path.join(basedir, "master.cfg.sample"), "r").read()) f.close() # the upgrade process (specifically the verify-master.cfg step) will # create any builder status directories that weren't already created. # Create those ahead of time. os.mkdir(os.path.join(basedir, "full")) files1 = self.record_files(basedir) # upgrade it options = runner.UpgradeMasterOptions() options.parseOptions(["--quiet", basedir]) cwd = os.getcwd() runner.upgradeMaster(options) os.chdir(cwd) files2 = self.record_files(basedir) self.failUnlessSameFiles(files1, files2) # now make it look like the one that 0.7.5 creates: no public_html for fn in os.listdir(os.path.join(basedir, "public_html")): os.unlink(os.path.join(basedir, "public_html", fn)) os.rmdir(os.path.join(basedir, "public_html")) # and make sure that upgrading it re-populates public_html options = runner.UpgradeMasterOptions() options.parseOptions(["-q", basedir]) cwd = os.getcwd() runner.upgradeMaster(options) os.chdir(cwd) files3 = self.record_files(basedir) self.failUnlessSameFiles(files1, files3) # now induce an error in master.cfg and make sure that upgrade # notices it. f = open(os.path.join(basedir, "master.cfg"), "a") f.write("raise RuntimeError('catch me please')\n") f.close() options = runner.UpgradeMasterOptions() options.parseOptions(["-q", basedir]) cwd = os.getcwd() rc = runner.upgradeMaster(options) os.chdir(cwd) self.failUnless(rc != 0, rc)
def startMaster(self, extraconfig): config = base_config + extraconfig rmdirRecursive("test_webparts") os.mkdir("test_webparts") runner.upgradeMaster({'basedir': "test_webparts", 'quiet': True, }) self.master = m = ConfiguredMaster("test_webparts", config) m.startService() # hack to find out what randomly-assigned port it is listening on port = list(self.find_webstatus(m)[0])[0]._port.getHost().port self.baseurl = "http://localhost:%d/" % port
def startMaster(self, extraconfig): config = base_config + extraconfig rmdirRecursive("test_webparts") os.mkdir("test_webparts") runner.upgradeMaster({ 'basedir': "test_webparts", 'quiet': True, }) self.master = m = ConfiguredMaster("test_webparts", config) m.startService() # hack to find out what randomly-assigned port it is listening on port = list(self.find_webstatus(m)[0])[0]._port.getHost().port self.baseurl = "http://localhost:%d/" % port
def startMaster(self, extraconfig): config = base_config + extraconfig os.makedirs(self.basedir) self.master = m = SimpleMaster(self.basedir) # use upgradeMaster to populate public_html/ with default.css runner.upgradeMaster({'basedir': self.basedir, 'quiet': True, 'db': "sqlite:///state.sqlite"}) m.startService() d = m.loadConfig(config) def _started(ign): # hack to find out what randomly-assigned port it is listening on port = list(self.find_webstatus(m)[0])[0]._port.getHost().port self.baseurl = "http://localhost:%d/" % port d.addCallback(_started) return d
def startMaster(self, extraconfig): config = base_config + extraconfig os.makedirs(self.basedir) self.master = m = SimpleMaster(self.basedir) # use upgradeMaster to populate public_html/ with default.css runner.upgradeMaster({ 'basedir': self.basedir, 'quiet': True, 'db': "sqlite:///state.sqlite" }) m.startService() d = m.loadConfig(config) def _started(ign): # hack to find out what randomly-assigned port it is listening on port = list(self.find_webstatus(m)[0])[0]._port.getHost().port self.baseurl = "http://localhost:%d/" % port d.addCallback(_started) return d