[Buildbot-commits] buildbot/buildbot/test test_runner.py, 1.16, 1.17

Brian Warner warner at users.sourceforge.net
Sun Sep 30 07:14:25 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16016/buildbot/test

Modified Files:
	test_runner.py 
Log Message:
[project @ upgrade-master: check master.cfg for problems, add docs]

Original author: warner at lothar.com
Date: 2007-09-30 07:13:39+00:00

Index: test_runner.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_runner.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test_runner.py	25 Sep 2007 20:39:49 -0000	1.16
+++ test_runner.py	30 Sep 2007 07:14:22 -0000	1.17
@@ -157,7 +157,8 @@
                              "*should* rewrite master.cfg.sample")
 
     def testUpgradeMaster(self):
-        # first, create a master and then upgrade it. Nothing should change.
+        # first, create a master, run it briefly, then upgrade it. Nothing
+        # should change.
         basedir = "test_runner.master2"
         options = runner.MasterOptions()
         options.parseOptions(["-q", basedir])
@@ -165,11 +166,20 @@
         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([basedir])
+        options.parseOptions(["--quiet", basedir])
         cwd = os.getcwd()
         runner.upgradeMaster(options)
         os.chdir(cwd)
@@ -177,14 +187,14 @@
         files2 = self.record_files(basedir)
         self.failUnlessSameFiles(files1, files2)
 
-        # now make it look like the one that 0.7.6 creates: no public_html
+        # 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([basedir])
+        options.parseOptions(["-q", basedir])
         cwd = os.getcwd()
         runner.upgradeMaster(options)
         os.chdir(cwd)
@@ -192,6 +202,23 @@
         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)
+        # TODO: change the way runner.py works to let us pass in a stderr
+        # filehandle, and use a StringIO to capture its output, and make sure
+        # the right error messages appear therein.
+
+
     def failUnlessSameFiles(self, files1, files2):
         f1 = sets.Set(files1.keys())
         f2 = sets.Set(files2.keys())





More information about the Commits mailing list