Opened at 2017-07-23T16:58:50Z
Last modified at 2020-11-30T18:53:19Z
#2891 new defect
fix intermittent test coverage
Reported by: | warner | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | undecided |
Component: | code | Version: | 1.12.1 |
Keywords: | Cc: | ||
Launchpad Bug: |
Description (last modified by exarkun)
This ticket is to keep track of lines which sometimes get covered during unit tests and which sometimes do not. This probably happens because those lines are only exercised by "system" -style tests, which randomly hit some servers and not others. We should fix these by writing more narrowly-focussed "unit"-style tests that exercise just the function in question, deterministically.
The most annoying thing about these tests is when they cause perfectly valid pull requests to be flagged as broken (because the test coverage happened to drop when they went through CI, through no fault of the PR's changes).
Let's strikeout these items as we fix them.
- src/allmydata/mutable/servermap.py
~L 39: UpdateStatus.add_per_server_time~- the status object's .timings["per_server"] attribute is a dict-of-lists, and line 39 handles the case where we *don't* have to add a new entry to the dict. This should just be replaced by a collections.defaultdict, rather than needing any new tests.
- L 923: ServermapUpdater._try_to_validate_privkey
- this clause checks that the share contained an (encrypted) RSA signing key that matches the expectation we got from the writecap. The clause should succeed for normal shares, but will fail for corrupted shares. Apparently we have a test that corrupts some shares, but which then doesn't always look at them.
- src/allmydata/mutable/publish.py
- L 451: Publish.publish
- to exercise this, we need some bad shares recorded in the servermap (ticket:3540)
- L 496 Publish.publish
- L 451: Publish.publish
- src/allmydata/immutable/upload.py
- Tahoe2ServerSelector._buckets_allocated()
- the if s in self.homeless_shares inside the non-Failure path doesn't always exercise both sides of the branch
- Tahoe2ServerSelector._buckets_allocated()
- src/allmydata/immutable/downloader/share.py
- Share.loop()
- this share-is-corrupted branch is not always exercised
- L228-236
- the DataUnavailable branch is not always exercised
- L277-279 Share._do_loop()
- this doesn't always see a non-empty disappointment array, and sometimes doesn't raise DataUnavailable. This is the parent cause of the L228-L236 non-coverage above.
- L386-389 _satisfy_offsets()
- the share_hashes_size test doesn't exercise both sides of the branch
- L761 _got_data()
- the if not self._alive check doesn't always exercise both branches
- Share.loop()
- src/allmydata/util/dictutil.py
- src/allmydata/stats.py
- L64-68 LoadMonitor.get_stats()
- noticed in a build of PR421
- get_stats() returns an average of the last 60 datapoints, but if there are no datapoints at all, a different branch is taken
- that no-datapoints branch is sometimes not covered by the tests
- L64-68 LoadMonitor.get_stats()
- src/allmydata/web/status.py
- also from that PR421 build
- L758 RetrieveStatusPage.render_server_timings()
- sometimes the fetch_per_server timing data is empty, which skips parts of this function
- L925 MapupdateStatusPage.render_privkey_from()
- sometimes this is called when the privkey has not been fetched, so it skips the affirmative side of the branch
- L1117 Status.childFactory()
- the loop that looks for a "down-%s" name in h.list_all_download_statuses() doesn't always exercise both sides of the if s.get_counter() == count clause
Change History (9)
comment:1 Changed at 2017-07-28T04:04:30Z by Brian Warner <warner@…>
comment:2 Changed at 2017-08-10T17:40:23Z by warner
- Description modified (diff)
added dictutil misses, updated format of the table, struck out the add_per_server_time that was fixed in [a4be2dc]
comment:3 Changed at 2017-08-10T18:40:06Z by Brian Warner <warner@…>
In 3f2f7df/trunk:
comment:4 Changed at 2017-08-10T18:41:50Z by warner
- Description modified (diff)
fixed dictutil.py (lines 29, 230, 438) with [3f2f7df]
comment:5 Changed at 2017-08-10T20:02:55Z by warner
- Description modified (diff)
added intermittence from an old build of PR421 (stats.py, web/status.py)
comment:6 Changed at 2017-08-10T21:59:23Z by warner
- Description modified (diff)
more intermittence noticed in tests: immutable/upload.py and immutable/downloader/share.py
comment:7 Changed at 2017-08-15T21:12:15Z by Brian Warner <warner@…>
In 27348be/trunk:
comment:8 Changed at 2017-08-15T21:14:24Z by warner
- Description modified (diff)
[27348be] deleted most of dictutil.py, so those lines are no longer a problem
comment:9 Changed at 2020-11-30T18:53:19Z by exarkun
- Description modified (diff)
In a4be2dc/trunk: