"Fossies" - the Fresh Open Source Software Archive

Member "buildbot-2.3.1/buildbot/test/unit/test_db_buildsets.py" (23 May 2019, 24762 Bytes) of package /linux/misc/buildbot-2.3.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "test_db_buildsets.py": 2.1.0_vs_2.2.0.

    1 # This file is part of Buildbot.  Buildbot is free software: you can
    2 # redistribute it and/or modify it under the terms of the GNU General Public
    3 # License as published by the Free Software Foundation, version 2.
    4 #
    5 # This program is distributed in the hope that it will be useful, but WITHOUT
    6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    7 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    8 # details.
    9 #
   10 # You should have received a copy of the GNU General Public License along with
   11 # this program; if not, write to the Free Software Foundation, Inc., 51
   12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   13 #
   14 # Copyright Buildbot Team Members
   15 
   16 
   17 import datetime
   18 import json
   19 
   20 import mock
   21 
   22 from twisted.internet import defer
   23 from twisted.trial import unittest
   24 
   25 from buildbot.db import buildsets
   26 from buildbot.test.fake import fakedb
   27 from buildbot.test.fake import fakemaster
   28 from buildbot.test.util import connector_component
   29 from buildbot.test.util import db
   30 from buildbot.test.util import interfaces
   31 from buildbot.test.util import validation
   32 from buildbot.test.util.misc import TestReactorMixin
   33 from buildbot.util import UTC
   34 from buildbot.util import datetime2epoch
   35 from buildbot.util import epoch2datetime
   36 
   37 
   38 class Tests(interfaces.InterfaceTests):
   39 
   40     def setUpTests(self):
   41         self.now = 9272359
   42         self.reactor.advance(self.now)
   43 
   44         # set up a sourcestamp with id 234 for use below
   45         return self.insertTestData([
   46             fakedb.SourceStamp(id=234),
   47             fakedb.Builder(id=1, name='bldr1'),
   48             fakedb.Builder(id=2, name='bldr2'),
   49         ])
   50 
   51     def test_signature_addBuildset(self):
   52         @self.assertArgSpecMatches(self.db.buildsets.addBuildset)
   53         def addBuildset(self, sourcestamps, reason, properties,
   54                         builderids, waited_for, external_idstring=None, submitted_at=None,
   55                         parent_buildid=None, parent_relationship=None):
   56             pass
   57 
   58     def test_signature_completeBuildset(self):
   59         @self.assertArgSpecMatches(self.db.buildsets.completeBuildset)
   60         def completeBuildset(self, bsid, results, complete_at=None):
   61             pass
   62 
   63     def test_signature_getBuildset(self):
   64         @self.assertArgSpecMatches(self.db.buildsets.getBuildset)
   65         def getBuildset(self, bsid):
   66             pass
   67 
   68     def test_signature_getBuildsets(self):
   69         @self.assertArgSpecMatches(self.db.buildsets.getBuildsets)
   70         def getBuildsets(self, complete=None, resultSpec=None):
   71             pass
   72 
   73     def test_signature_getRecentBuildsets(self):
   74         @self.assertArgSpecMatches(self.db.buildsets.getRecentBuildsets)
   75         def getBuildsets(self, count=None, branch=None, repository=None,
   76                          complete=None):
   77             pass
   78 
   79     def test_signature_getBuildsetProperties(self):
   80         @self.assertArgSpecMatches(self.db.buildsets.getBuildsetProperties)
   81         def getBuildsetProperties(self, key, no_cache=False):
   82             pass
   83 
   84     @defer.inlineCallbacks
   85     def test_addBuildset_getBuildset(self):
   86         bsid, brids = yield self.db.buildsets.addBuildset(
   87                 sourcestamps=[234], reason='because', properties={},
   88                 builderids=[1], external_idstring='extid', waited_for=False)
   89 
   90         # TODO: verify buildrequests too
   91         bsdict = yield self.db.buildsets.getBuildset(bsid)
   92         validation.verifyDbDict(self, 'bsdict', bsdict)
   93         self.assertEqual(bsdict, dict(external_idstring='extid',
   94                                       reason='because', sourcestamps=[234],
   95                                       submitted_at=datetime.datetime(1970, 4, 18, 7, 39, 19,
   96                                                                      tzinfo=UTC),
   97                                       complete=False, complete_at=None, results=-1,
   98                                       parent_buildid=None, parent_relationship=None,
   99                                       bsid=bsid))
  100 
  101     @defer.inlineCallbacks
  102     def test_addBuildset_getBuildset_explicit_submitted_at(self):
  103         bsid_brids = yield self.db.buildsets.addBuildset(
  104                 sourcestamps=[234], reason='because', properties={},
  105                 builderids=[1], external_idstring='extid',
  106                 submitted_at=epoch2datetime(8888888),
  107                 waited_for=False)
  108         bsdict = yield self.db.buildsets.getBuildset(bsid_brids[0])
  109 
  110         validation.verifyDbDict(self, 'bsdict', bsdict)
  111         self.assertEqual(bsdict, dict(external_idstring='extid',
  112                                       reason='because', sourcestamps=[234],
  113                                       submitted_at=datetime.datetime(1970, 4, 13, 21, 8, 8,
  114                                                                      tzinfo=UTC),
  115                                       complete=False, complete_at=None, results=-1,
  116                                       parent_buildid=None, parent_relationship=None,
  117                                       bsid=bsdict['bsid']))
  118 
  119     @defer.inlineCallbacks
  120     def do_test_getBuildsetProperties(self, buildsetid, rows, expected):
  121         yield self.insertTestData(rows)
  122         props = yield self.db.buildsets.getBuildsetProperties(buildsetid)
  123 
  124         self.assertEqual(props, expected)
  125 
  126     def test_getBuildsetProperties_multiple(self):
  127         return self.do_test_getBuildsetProperties(91, [
  128             fakedb.Buildset(id=91, complete=0, results=-1, submitted_at=0),
  129             fakedb.BuildsetProperty(buildsetid=91, property_name='prop1',
  130                                     property_value='["one", "fake1"]'),
  131             fakedb.BuildsetProperty(buildsetid=91, property_name='prop2',
  132                                     property_value='["two", "fake2"]'),
  133         ], dict(prop1=("one", "fake1"), prop2=("two", "fake2")))
  134 
  135     def test_getBuildsetProperties_empty(self):
  136         return self.do_test_getBuildsetProperties(91, [
  137             fakedb.Buildset(id=91, complete=0, results=-1, submitted_at=0),
  138         ], dict())
  139 
  140     def test_getBuildsetProperties_nosuch(self):
  141         "returns an empty dict even if no such buildset exists"
  142         return self.do_test_getBuildsetProperties(91, [], dict())
  143 
  144     @defer.inlineCallbacks
  145     def test_getBuildset_incomplete_zero(self):
  146         yield self.insertTestData([
  147             fakedb.Buildset(id=91, complete=0,
  148                             complete_at=0, results=-1, submitted_at=266761875,
  149                             external_idstring='extid', reason='rsn'),
  150             fakedb.BuildsetSourceStamp(buildsetid=91, sourcestampid=234),
  151         ])
  152         bsdict = yield self.db.buildsets.getBuildset(91)
  153 
  154         validation.verifyDbDict(self, 'bsdict', bsdict)
  155         self.assertEqual(bsdict, dict(external_idstring='extid',
  156                                       reason='rsn', sourcestamps=[234],
  157                                       submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 15,
  158                                                                      tzinfo=UTC),
  159                                       complete=False,
  160                                       complete_at=epoch2datetime(0), results=-1,
  161                                       bsid=91,
  162                                       parent_buildid=None, parent_relationship=None))
  163 
  164     @defer.inlineCallbacks
  165     def test_getBuildset_complete(self):
  166         yield self.insertTestData([
  167             fakedb.Buildset(id=91, complete=1,
  168                             complete_at=298297875, results=-1, submitted_at=266761875,
  169                             external_idstring='extid', reason='rsn'),
  170             fakedb.BuildsetSourceStamp(buildsetid=91, sourcestampid=234),
  171         ])
  172         bsdict = yield self.db.buildsets.getBuildset(91)
  173 
  174         validation.verifyDbDict(self, 'bsdict', bsdict)
  175         self.assertEqual(bsdict, dict(external_idstring='extid',
  176                                       reason='rsn', sourcestamps=[234],
  177                                       submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 15,
  178                                                                      tzinfo=UTC),
  179                                       complete=True,
  180                                       complete_at=datetime.datetime(1979, 6, 15, 12, 31, 15,
  181                                                                     tzinfo=UTC),
  182                                       results=-1,
  183                                       bsid=91,
  184                                       parent_buildid=None, parent_relationship=None))
  185 
  186     @defer.inlineCallbacks
  187     def test_getBuildset_nosuch(self):
  188         bsdict = yield self.db.buildsets.getBuildset(91)
  189 
  190         self.assertEqual(bsdict, None)
  191 
  192     def insert_test_getBuildsets_data(self):
  193         return self.insertTestData([
  194             fakedb.Buildset(id=91, complete=0,
  195                             complete_at=298297875, results=-1, submitted_at=266761875,
  196                             external_idstring='extid', reason='rsn1'),
  197             fakedb.BuildsetSourceStamp(buildsetid=91, sourcestampid=234),
  198             fakedb.Buildset(id=92, complete=1,
  199                             complete_at=298297876, results=7, submitted_at=266761876,
  200                             external_idstring='extid', reason='rsn2'),
  201             fakedb.BuildsetSourceStamp(buildsetid=92, sourcestampid=234),
  202         ])
  203 
  204     @defer.inlineCallbacks
  205     def test_getBuildsets_empty(self):
  206         bsdictlist = yield self.db.buildsets.getBuildsets()
  207 
  208         self.assertEqual(bsdictlist, [])
  209 
  210     @defer.inlineCallbacks
  211     def test_getBuildsets_all(self):
  212         yield self.insert_test_getBuildsets_data()
  213         bsdictlist = yield self.db.buildsets.getBuildsets()
  214 
  215         def bsdictKey(bsdict):
  216             return bsdict['reason']
  217 
  218         for bsdict in bsdictlist:
  219             validation.verifyDbDict(self, 'bsdict', bsdict)
  220         self.assertEqual(sorted(bsdictlist, key=bsdictKey), sorted([
  221             dict(external_idstring='extid', reason='rsn1', sourcestamps=[234],
  222                  submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 15,
  223                                                 tzinfo=UTC),
  224                  complete_at=datetime.datetime(1979, 6, 15, 12, 31, 15,
  225                                                tzinfo=UTC),
  226                  complete=False, results=-1, bsid=91,
  227                  parent_buildid=None, parent_relationship=None),
  228             dict(external_idstring='extid', reason='rsn2', sourcestamps=[234],
  229                  submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 16,
  230                                                 tzinfo=UTC),
  231                  complete_at=datetime.datetime(1979, 6, 15, 12, 31, 16,
  232                                                tzinfo=UTC),
  233                  complete=True, results=7, bsid=92,
  234                  parent_buildid=None, parent_relationship=None),
  235         ], key=bsdictKey))
  236 
  237     @defer.inlineCallbacks
  238     def test_getBuildsets_complete(self):
  239         yield self.insert_test_getBuildsets_data()
  240         bsdictlist = yield self.db.buildsets.getBuildsets(complete=True)
  241 
  242         for bsdict in bsdictlist:
  243             validation.verifyDbDict(self, 'bsdict', bsdict)
  244         self.assertEqual(bsdictlist, [
  245             dict(external_idstring='extid', reason='rsn2', sourcestamps=[234],
  246                  submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 16,
  247                                                 tzinfo=UTC),
  248                  complete_at=datetime.datetime(1979, 6, 15, 12, 31, 16,
  249                                                tzinfo=UTC),
  250                  complete=True, results=7, bsid=92,
  251                  parent_buildid=None, parent_relationship=None),
  252         ])
  253 
  254     @defer.inlineCallbacks
  255     def test_getBuildsets_incomplete(self):
  256         yield self.insert_test_getBuildsets_data()
  257         bsdictlist = yield self.db.buildsets.getBuildsets(complete=False)
  258 
  259         for bsdict in bsdictlist:
  260             validation.verifyDbDict(self, 'bsdict', bsdict)
  261         self.assertEqual(bsdictlist, [
  262             dict(external_idstring='extid', reason='rsn1', sourcestamps=[234],
  263                  submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 15,
  264                                                 tzinfo=UTC),
  265                  complete_at=datetime.datetime(1979, 6, 15, 12, 31, 15,
  266                                                tzinfo=UTC),
  267                  complete=False, results=-1, bsid=91,
  268                  parent_buildid=None, parent_relationship=None),
  269         ])
  270 
  271     def test_completeBuildset_already_completed(self):
  272         d = self.insert_test_getBuildsets_data()
  273         d.addCallback(lambda _:
  274                       self.db.buildsets.completeBuildset(bsid=92, results=6))
  275         return self.assertFailure(d, buildsets.AlreadyCompleteError)
  276 
  277     def test_completeBuildset_missing(self):
  278         d = self.insert_test_getBuildsets_data()
  279         d.addCallback(lambda _:
  280                       self.db.buildsets.completeBuildset(bsid=93, results=6))
  281         return self.assertFailure(d, buildsets.AlreadyCompleteError)
  282 
  283     @defer.inlineCallbacks
  284     def test_completeBuildset(self):
  285         yield self.insert_test_getBuildsets_data()
  286         yield self.db.buildsets.completeBuildset(bsid=91, results=6)
  287         bsdicts = yield self.db.buildsets.getBuildsets()
  288 
  289         bsdicts = [(bsdict['bsid'], bsdict['complete'],
  290                     datetime2epoch(bsdict['complete_at']),
  291                     bsdict['results'])
  292                    for bsdict in bsdicts]
  293         self.assertEqual(sorted(bsdicts), sorted([
  294             (91, 1, self.now, 6),
  295             (92, 1, 298297876, 7)]))
  296 
  297     @defer.inlineCallbacks
  298     def test_completeBuildset_explicit_complete_at(self):
  299         yield self.insert_test_getBuildsets_data()
  300         yield self.db.buildsets.completeBuildset(bsid=91, results=6,
  301                                              complete_at=epoch2datetime(72759))
  302         bsdicts = yield self.db.buildsets.getBuildsets()
  303 
  304         bsdicts = [(bsdict['bsid'], bsdict['complete'],
  305                     datetime2epoch(bsdict['complete_at']),
  306                     bsdict['results'])
  307                    for bsdict in bsdicts]
  308         self.assertEqual(sorted(bsdicts), sorted([
  309             (91, 1, 72759, 6),
  310             (92, 1, 298297876, 7)]))
  311 
  312     def insert_test_getRecentBuildsets_data(self):
  313         return self.insertTestData([
  314             fakedb.SourceStamp(id=91, branch='branch_a', repository='repo_a'),
  315 
  316             fakedb.Buildset(id=91, complete=0,
  317                             complete_at=298297875, results=-1, submitted_at=266761875,
  318                             external_idstring='extid', reason='rsn1'),
  319             fakedb.BuildsetSourceStamp(buildsetid=91, sourcestampid=91),
  320             fakedb.Buildset(id=92, complete=1,
  321                             complete_at=298297876, results=7, submitted_at=266761876,
  322                             external_idstring='extid', reason='rsn2'),
  323             fakedb.BuildsetSourceStamp(buildsetid=92, sourcestampid=91),
  324 
  325             # buildset unrelated to the change
  326             fakedb.Buildset(id=93, complete=1,
  327                             complete_at=298297877, results=7, submitted_at=266761877,
  328                             external_idstring='extid', reason='rsn2'),
  329         ])
  330 
  331     @defer.inlineCallbacks
  332     def test_getRecentBuildsets_all(self):
  333         yield self.insert_test_getRecentBuildsets_data()
  334         bsdictlist = yield self.db.buildsets.getRecentBuildsets(2,
  335                                                             branch='branch_a',
  336                                                             repository='repo_a')
  337 
  338         self.assertEqual(bsdictlist, [
  339             dict(external_idstring='extid', reason='rsn1', sourcestamps=[91],
  340                  submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 15,
  341                                                 tzinfo=UTC),
  342                  complete_at=datetime.datetime(1979, 6, 15, 12, 31, 15,
  343                                                tzinfo=UTC),
  344                  complete=False, results=-1, bsid=91,
  345                  parent_buildid=None, parent_relationship=None),
  346             dict(external_idstring='extid', reason='rsn2', sourcestamps=[91],
  347                  submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 16,
  348                                                 tzinfo=UTC),
  349                  complete_at=datetime.datetime(1979, 6, 15, 12, 31, 16,
  350                                                tzinfo=UTC),
  351                  complete=True, results=7, bsid=92,
  352                  parent_buildid=None, parent_relationship=None)
  353         ])
  354 
  355     @defer.inlineCallbacks
  356     def test_getRecentBuildsets_one(self):
  357         yield self.insert_test_getRecentBuildsets_data()
  358         bsdictlist = yield self.db.buildsets.getRecentBuildsets(1,
  359                                                             branch='branch_a',
  360                                                             repository='repo_a')
  361 
  362         self.assertEqual(bsdictlist, [
  363             dict(external_idstring='extid', reason='rsn2', sourcestamps=[91],
  364                  submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 16,
  365                                                 tzinfo=UTC),
  366                  complete_at=datetime.datetime(1979, 6, 15, 12, 31, 16,
  367                                                tzinfo=UTC),
  368                  complete=True, results=7, bsid=92,
  369                  parent_buildid=None, parent_relationship=None),
  370         ])
  371 
  372     @defer.inlineCallbacks
  373     def test_getRecentBuildsets_zero(self):
  374         yield self.insert_test_getRecentBuildsets_data()
  375         bsdictlist = yield self.db.buildsets.getRecentBuildsets(0,
  376                                                             branch='branch_a',
  377                                                             repository='repo_a')
  378 
  379         self.assertEqual(bsdictlist, [])
  380 
  381     @defer.inlineCallbacks
  382     def test_getRecentBuildsets_noBranchMatch(self):
  383         yield self.insert_test_getRecentBuildsets_data()
  384         bsdictlist = yield self.db.buildsets.getRecentBuildsets(2,
  385                                                             branch='bad_branch',
  386                                                             repository='repo_a')
  387 
  388         self.assertEqual(bsdictlist, [])
  389 
  390     @defer.inlineCallbacks
  391     def test_getRecentBuildsets_noRepoMatch(self):
  392         yield self.insert_test_getRecentBuildsets_data()
  393         bsdictlist = yield self.db.buildsets.getRecentBuildsets(2,
  394                                                           branch='branch_a',
  395                                                           repository='bad_repo')
  396 
  397         self.assertEqual(bsdictlist, [])
  398 
  399 
  400 class RealTests(Tests):
  401 
  402     @defer.inlineCallbacks
  403     def test_addBuildset_simple(self):
  404         (bsid, brids) = yield self.db.buildsets.addBuildset(
  405                 sourcestamps=[234], reason='because', properties={},
  406                 builderids=[2], external_idstring='extid', waited_for=True)
  407 
  408         def thd(conn):
  409             # we should only have one brid
  410             self.assertEqual(len(brids), 1)
  411 
  412             # should see one buildset row
  413             r = conn.execute(self.db.model.buildsets.select())
  414             rows = [(row.id, row.external_idstring, row.reason,
  415                      row.complete, row.complete_at,
  416                      row.submitted_at, row.results) for row in r.fetchall()]
  417             self.assertEqual(rows,
  418                              [(bsid, 'extid', 'because', 0, None, self.now, -1)])
  419 
  420             # one buildrequests row
  421             r = conn.execute(self.db.model.buildrequests.select())
  422             self.assertEqual(r.keys(),
  423                              ['id', 'buildsetid', 'builderid', 'priority',
  424                               'complete', 'results', 'submitted_at',
  425                               'complete_at', 'waited_for'])
  426             self.assertEqual(r.fetchall(),
  427                              [(bsid, brids[2], 2, 0, 0,
  428                                -1, self.now, None, 1)])
  429 
  430             # one buildset_sourcestamps row
  431             r = conn.execute(self.db.model.buildset_sourcestamps.select())
  432             self.assertEqual(
  433                 list(r.keys()), ['id', 'buildsetid', 'sourcestampid'])
  434             self.assertEqual(r.fetchall(), [(1, bsid, 234)])
  435         yield self.db.pool.do(thd)
  436 
  437     @defer.inlineCallbacks
  438     def test_addBuildset_bigger(self):
  439         props = dict(prop=(['list'], 'test'))
  440         yield defer.succeed(None)
  441         xxx_todo_changeme1 = yield self.db.buildsets.addBuildset(
  442                                         sourcestamps=[234], reason='because',
  443                                         waited_for=False, properties=props,
  444                                         builderids=[1, 2])
  445 
  446         (bsid, brids) = xxx_todo_changeme1
  447 
  448         def thd(conn):
  449             self.assertEqual(len(brids), 2)
  450 
  451             # should see one buildset row
  452             r = conn.execute(self.db.model.buildsets.select())
  453             rows = [(row.id, row.external_idstring, row.reason,
  454                      row.complete, row.complete_at, row.results)
  455                     for row in r.fetchall()]
  456             self.assertEqual(rows,
  457                              [(bsid, None, 'because', 0, None, -1)])
  458 
  459             # one property row
  460             r = conn.execute(self.db.model.buildset_properties.select())
  461             rows = [(row.buildsetid, row.property_name, row.property_value)
  462                     for row in r.fetchall()]
  463             self.assertEqual(rows,
  464                              [(bsid, 'prop', json.dumps([['list'], 'test']))])
  465 
  466             # one buildset_sourcestamps row
  467             r = conn.execute(self.db.model.buildset_sourcestamps.select())
  468             rows = [(row.buildsetid, row.sourcestampid)
  469                     for row in r.fetchall()]
  470             self.assertEqual(rows, [(bsid, 234)])
  471 
  472             # and two buildrequests rows (and don't re-check the default
  473             # columns)
  474             r = conn.execute(self.db.model.buildrequests.select())
  475             rows = [(row.buildsetid, row.id, row.builderid)
  476                     for row in r.fetchall()]
  477 
  478             # we don't know which of the brids is assigned to which
  479             # buildername, but either one will do
  480             self.assertEqual(sorted(rows),
  481                              [(bsid, brids[1], 1), (bsid, brids[2], 2)])
  482         yield self.db.pool.do(thd)
  483 
  484 
  485 class TestFakeDB(TestReactorMixin, unittest.TestCase, Tests):
  486 
  487     def setUp(self):
  488         self.setUpTestReactor()
  489         self.master = fakemaster.make_master(self, wantDb=True)
  490         self.db = self.master.db
  491         self.db.checkForeignKeys = True
  492         self.insertTestData = self.db.insertTestData
  493         return self.setUpTests()
  494 
  495     @defer.inlineCallbacks
  496     def test_addBuildset_bad_waited_for(self):
  497         # only the fake db asserts on the type of waited_for
  498         d = self.db.buildsets.addBuildset(sourcestamps=[234], reason='because',
  499                                           properties={}, builderids=[1],
  500                                           external_idstring='extid',
  501                                           waited_for='wat')
  502         yield self.assertFailure(d, AssertionError)
  503 
  504 
  505 class TestRealDB(db.TestCase,
  506                  connector_component.ConnectorComponentMixin,
  507                  RealTests):
  508 
  509     @defer.inlineCallbacks
  510     def setUp(self):
  511         yield self.setUpConnectorComponent(
  512             table_names=['patches', 'buildsets', 'buildset_properties',
  513                          'objects', 'buildrequests', 'sourcestamps',
  514                          'buildset_sourcestamps', 'builders',
  515                          'builds', 'masters', 'workers'])
  516 
  517         self.db.buildsets = buildsets.BuildsetsConnectorComponent(self.db)
  518         yield self.setUpTests()
  519 
  520     def tearDown(self):
  521         return self.tearDownConnectorComponent()
  522 
  523     @defer.inlineCallbacks
  524     def test_addBuildset_properties_cache(self):
  525         """
  526         Test that `addChange` properly seeds the `getChange` cache.
  527         """
  528 
  529         # Patchup the buildset properties cache so we can verify that
  530         # it got called form `addBuildset`.
  531         mockedCachePut = mock.Mock()
  532         self.patch(
  533             self.db.buildsets.getBuildsetProperties.cache,
  534             "put", mockedCachePut)
  535 
  536         # Setup a dummy set of properties to insert with the buildset.
  537         props = dict(prop=(['list'], 'test'))
  538 
  539         # Now, call `addBuildset`, and verify that the above properties
  540         # were seed in the `getBuildsetProperties` cache.
  541         bsid, _ = yield self.db.buildsets.addBuildset(
  542             sourcestamps=[234], reason='because',
  543             properties=props, builderids=[1, 2],
  544             waited_for=False)
  545         mockedCachePut.assert_called_once_with(bsid, props)