Skip to content

Commit

Permalink
add upgrade test from v0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed May 28, 2012
1 parent 935399f commit 2717407
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
3 changes: 0 additions & 3 deletions master/buildbot/status/build.py
Expand Up @@ -211,9 +211,6 @@ def getTestResults(self):
return self.testResults

def getLogs(self):
# TODO: steps should contribute significant logs instead of this
# hack, which returns every log from every step. The logs should get
# names like "compile" and "test" instead of "compile.output"
logs = []
for s in self.steps:
for loog in s.getLogs():
Expand Down
51 changes: 50 additions & 1 deletion master/buildbot/test/integration/test_upgrade.py
Expand Up @@ -107,7 +107,7 @@ def setUpUpgradeTest(self):
os.makedirs("basedir")
self.basedir = os.path.abspath("basedir")

master = fakemaster.make_master()
self.master = master = fakemaster.make_master()
master.config.db['db_url'] = self.db_url
self.db = connector.DBConnector(master, self.basedir)
yield self.db.setup(check_version=False)
Expand Down Expand Up @@ -490,6 +490,55 @@ def test_upgrade(self):
return self.do_test_upgrade()


class UpgradeTestV085(UpgradeTestMixin, unittest.TestCase):

source_tarball = "v085.tgz"

def verify_thd(self, conn):
"partially verify the contents of the db - run in a thread"
model = self.db.model

tbl = model.buildrequests
r = conn.execute(tbl.select(order_by=tbl.c.id))
buildreqs = [ (br.id, br.buildsetid,
br.complete, br.results)
for br in r.fetchall() ]
self.assertEqual(buildreqs, [(1, 1, 1, 0), (2, 2, 1, 0)])

br_claims = model.buildrequest_claims
objects = model.objects
r = conn.execute(sa.select([ br_claims.outerjoin(objects,
br_claims.c.objectid == objects.c.id)]))
buildreqs = [ (brc.brid, int(brc.claimed_at), brc.name, brc.class_name)
for brc in r.fetchall() ]
self.assertEqual(buildreqs, [
(1, 1338226540, u'euclid.r.igoro.us:/A/bbrun',
u'buildbot.master.BuildMaster'),
(2, 1338226574, u'euclid.r.igoro.us:/A/bbrun',
u'buildbot.master.BuildMaster')
])

def test_upgrade(self):
d = self.do_test_upgrade()
@d.addCallback
def check_pickles(_):
# try to unpickle things down to the level of a logfile
filename = os.path.join(self.basedir, 'builder', 'builder')
with open(filename, "rb") as f:
builder_status = cPickle.load(f)
builder_status.master = self.master
builder_status.basedir = os.path.join(self.basedir, 'builder')
b1 = builder_status.loadBuildFromFile(1)
logs = b1.getLogs()
log = logs[0]
text = log.getText()
self.assertIn('HEAD is now at', text)
b2 = builder_status.loadBuildFromFile(1)
self.assertEqual(b2.getReason(),
"The web-page 'rebuild' button was pressed by '<unknown>': \n")
return d


class TestWeirdChanges(change_import.ChangeImportMixin, unittest.TestCase):
def setUp(self):
d = self.setUpChangeImport()
Expand Down
4 changes: 4 additions & 0 deletions master/buildbot/test/integration/v085-README.txt
@@ -0,0 +1,4 @@
-- Basic v0.8.5 tarball --

This tarball is the result of a few runs from a single incarnation of a master
that was running Buildbot-0.8.5.
Binary file added master/buildbot/test/integration/v085.tgz
Binary file not shown.

0 comments on commit 2717407

Please sign in to comment.