Merge lp://staging/~wallyworld/launchpad/latest-builds-failed-recipe-build into lp://staging/launchpad

Proposed by Ian Booth
Status: Merged
Approved by: Leonard Richardson
Approved revision: no longer in the source branch.
Merged at revision: 12311
Proposed branch: lp://staging/~wallyworld/launchpad/latest-builds-failed-recipe-build
Merge into: lp://staging/launchpad
Diff against target: 165 lines (+58/-28)
5 files modified
lib/lp/code/browser/sourcepackagerecipe.py (+5/-1)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+7/-5)
lib/lp/code/model/recipebuild.py (+1/-21)
lib/lp/code/model/sourcepackagerecipe.py (+4/-1)
lib/lp/services/database/stormexpr.py (+41/-0)
To merge this branch: bzr merge lp://staging/~wallyworld/launchpad/latest-builds-failed-recipe-build
Reviewer Review Type Date Requested Status
Leonard Richardson (community) Approve
Review via email: mp+48090@code.staging.launchpad.net

Commit message

[r=leonardr][ui=none][bug=680733] Fix query used to load recipe build jobs so those which have failed to build expire off the recent builds list as expected

Description of the change

The query used to load the recipe build jobs was broken because it allowed failed builds to hang around at the top of the recent builds list and never expire. Details are in the bug 680733

== Implementation ==

Modify the getBuilds() query order by expression to order by greatest(date_finished, date_started). This allows expected ordering of builds which have started but failed to finish.

An extension to Storm was required - Storm does not provide a greatest() function. This was added into a new file lp.services.database.stormexpr.py. As a drive by, another similar Storm expression (CountDistinct) used in lp.code.model.recipebuild.py was also moved here.

== Tests ==

lp.code.browser.tests.test_sourcepackagerecipe.test_builds() - there were issues with this test. It was incorrectly trying to set a date_completed field on a recipe build job (should be date_finished) and in places was using set() to compare expected/actual build listings instead of lists (and thus the required ordering was not always being tested). Fixing these issues made the test as written fail (which is good) and then the test passed again when the fix was implemented.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/browser/sourcepackagerecipe.py
  lib/lp/code/browser/tests/test_sourcepackagerecipe.py
  lib/lp/code/model/recipebuild.py
  lib/lp/code/model/sourcepackagerecipe.py
  lib/lp/services/database/stormexpr.py

./lib/lp/code/browser/tests/test_sourcepackagerecipe.py
     389: E501 line too long (80 characters)
     886: E501 line too long (85 characters)
     916: E501 line too long (85 characters)
     951: E501 line too long (85 characters)
     389: Line exceeds 78 characters.
     886: Line exceeds 78 characters.
     916: Line exceeds 78 characters.
     938: Line exceeds 78 characters.
     951: Line exceeds 78 characters.
./lib/lp/services/database/stormexpr.py
      21: E302 expected 2 blank lines, found 1
      28: E302 expected 2 blank lines, found 1

To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.