Merge lp:~julian-edwards/launchpad/bug-517098 into lp:launchpad/db-devel

Proposed by Julian Edwards
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~julian-edwards/launchpad/bug-517098
Merge into: lp:launchpad/db-devel
Diff against target: 25 lines (+7/-1)
2 files modified
cronscripts/update-pkgcache.py (+1/-1)
database/schema/security.cfg (+6/-0)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/bug-517098
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Graham Binns (community) code Approve
Review via email: mp+20908@code.launchpad.net

Description of the change

Give update-pkg-cache.py its own database user for stub.

PackageCacheUpdater doesn't have any tests so I'll Q/A this on dogfood.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote :

Hi Julian,

This branch is good to land, but I've one question:

> === modified file 'lib/lp/soyuz/tests/test_buildqueue.py'
> --- lib/lp/soyuz/tests/test_buildqueue.py 2010-02-25 16:34:13 +0000
> +++ lib/lp/soyuz/tests/test_buildqueue.py 2010-03-08 16:50:38 +0000
> @@ -96,8 +96,12 @@
> queue_entry.lastscore)
>
>
> -def check_mintime_to_builder(test, bq, min_time):
> +def check_mintime_to_builder(
> + test, bq, min_time, time_stamp=datetime.utcnow()):

Isn't this default a bit fragile? It would be better to declare the
default as None and then have

    if time_stamp is None:
        time_stamp = datetime.utcnow()

in the test, wouldn't it?

> """Test the estimated time until a builder becomes available."""
> + # Monkey-patch BuildQueueSet._now() so it returns a constant time stamp
> + # that's not too far in the future. This avoids spurious test failures.
> + monkey_patch_the_now_property(bq)
> delay = bq._estimateTimeToNextBuilder()
> test.assertTrue(
> delay <= min_time,

Otherwise, r=me.

review: Approve (code)
Revision history for this message
Stuart Bishop (stub) wrote :

DB related stuff is all good. No need for me to review this really.

review: Approve (db)
Revision history for this message
Julian Edwards (julian-edwards) wrote :

The diff is crack, I branched off devel by mistake and this is targeted to db-devel :(

I've pushed up a new branch that was branched from db-devel. gmb already approved the tiny diff in IRC.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cronscripts/update-pkgcache.py'
2--- cronscripts/update-pkgcache.py 2009-11-17 02:33:27 +0000
3+++ cronscripts/update-pkgcache.py 2010-03-10 09:56:33 +0000
4@@ -101,6 +101,6 @@
5
6 if __name__ == '__main__':
7 script = PackageCacheUpdater(
8- 'update-cache', dbuser=config.statistician.dbuser)
9+ 'update-cache', dbuser="update-pkg-cache")
10 script.lock_and_run()
11
12
13=== modified file 'database/schema/security.cfg'
14--- database/schema/security.cfg 2010-03-05 11:46:55 +0000
15+++ database/schema/security.cfg 2010-03-10 09:56:33 +0000
16@@ -1914,3 +1914,9 @@
17 public.apportjob = SELECT, INSERT, UPDATE, DELETE
18 public.libraryfilealias = SELECT, INSERT, UPDATE
19 public.libraryfilecontent = SELECT, INSERT, UPDATE
20+
21+[update-pkg-cache]
22+# update-pkg-cache.py split off from the statistician user so that it's easier
23+# to see its activity separate from update-stats.py
24+type=user
25+groups=statistician

Subscribers

People subscribed via source and target branches

to status/vote changes: