Merge lp://staging/~abentley/launchpad/fix-592319 into lp://staging/launchpad

Proposed by Aaron Bentley
Status: Merged
Approved by: Māris Fogels
Approved revision: no longer in the source branch.
Merged at revision: 11012
Proposed branch: lp://staging/~abentley/launchpad/fix-592319
Merge into: lp://staging/launchpad
Diff against target: 71 lines (+16/-7)
2 files modified
lib/lp/soyuz/tests/test_archive.py (+1/-1)
lib/lp/testing/factory.py (+15/-6)
To merge this branch: bzr merge lp://staging/~abentley/launchpad/fix-592319
Reviewer Review Type Date Requested Status
Māris Fogels (community) Approve
Review via email: mp+27552@code.staging.launchpad.net

Commit message

Use a random starting integer instead of a UUID.

Description of the change

= Summary =
Fix bug #592319: test_match_exact_branch_name fails spuriously

== Proposed fix ==
Append an integer, rather than a UUID, to the base of generic strings. This
allows us to retain our assertions that generic strings do not contain specific
non-numeric strings. However, while the integer will increment normally,
the starting point of the integer is random, so that multiple runs can be done
against the same database without conflicts.

== Pre-implementation notes ==
Discussed parameters of a solution with BjornT

== Implementation details ==
Used thread-local storage so that this approach is thread-safe. Each thread
will use its own random starting point.

Used a range between 0 and 1,000,000 for the starting point, because using
maxint/2 exceeded maximum database values.

== Tests ==
bin/test -v

== Demo and Q/A ==
None. This is a fix for a transient failure, so you can never be sure that it
*would* have failed.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/testing/factory.py

To post a comment you must log in.
Revision history for this message
Māris Fogels (mars) wrote :

Hi Aaron,

This looks good. Brilliant use of Python builtins. r=mars

Maris

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.