Merge lp:~benji/launchpad/bug-953913 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Gary Poster on 2012-03-23 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15005 |
| Proposed branch: | lp:~benji/launchpad/bug-953913 |
| Merge into: | lp:launchpad |
| Diff against target: |
15 lines (+3/-2) 1 file modified
lib/lp/translations/tests/test_translationpackagingjob.py (+3/-2) |
| To merge this branch: | bzr merge lp:~benji/launchpad/bug-953913 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Gary Poster (community) | 2012-03-23 | Approve on 2012-03-23 | |
|
Review via email:
|
|||
Commit Message
fix a test fragility by making translation template's sharing key consistent between test runs
Description of the Change
During the Yellow squad's work we have found many tests that have
inter-test dependencies, this branch fixes one of them.
When run independently the TestTranslation
test fails (intermittently for some, consistently for others). It turns
out that the test fails because the sharingKey value can vary between
runs. This branch makes the sharingKey consistent so the values the
test verifies are consistent from one run to another.
Tests:
bin/test -c -t lp.translations
Lint: the lint report is clean
QA: none
| Данило Шеган (danilo) wrote : | # |
Hi guys, sorry for taking a look at this so late (I wasn't working the Thu/Fri).
I find it interesting that this has failed intermittently. Let me digest what happens in a test (the fact that this fix is here helps with that a lot :).
`potemplate` is the template we are renaming with one `potmsgset`.
`old_shared` is sharing with `potemplate` that same potmsgset.
`new_shared` is a different template with a different `target_potmsgset` but identical English text for it.
`potemplate` is renamed to start sharing with `new_shared`.
Two things happen:
1. splitting: `potmsgset` is split into two similar ones: one in `potemplate`, another in `old_shared` (this should have nothing to do with development_focus)
2. merging: whatever came out of 1 and ended up in `old_shared` (could be `potmsgset` itself or a different potmsgset object), and `target_potmsgset` into a single potmsgset, with the development_focus potmsgset being preferred for keeping.
So, if there's any instability (for this particular test), it's probably in how splitting is done (i.e. sometimes we get the translation_focus `potmsgset` in old_shared, sometimes a new POTMsgSet), and it'd probably make sense to make that use sharingKey as well, i.e. prefer to keep the translation_focus potmsgset object where it is. Then, in 1, we'd always have `potmsgset` remain in `potemplate`, and `old_shared` will end up with eg. `split_potmsgset`. But then, both of `split_potmsgset` and `target_potmsgset` and which one is kept on merging would depend on their IDs, which in testing we can probably rely on to grow sequentially, but shouldn't.
Basically, this code produces a few equivalent, but non-identical "solutions" to the splitting/merging problem. It makes it harder to unit-test, which is likely why I introduced the problem :)
So, IMHO, for this particular test, it would be better to remove the dependency on the development_focus altogether. I suspect having
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -340,7 +340,9 @@
# New POTMsgSet is now different from the old one (it's been split),
# but matches the target potmsgset (it's been merged into it).
- self.assertNotE
+ old_potmsgset = old_shared.
+ target_potmsgset = new_shared.
+ self.assertNotE
# Translations have been merged as well.
would be a sufficient (and more correct) fix instead of the one here (though, adding a comment why is this needed to refetch all the potmsgsets would be rather helpful :).

Nice, thank you