#2891 new defect

fix intermittent test coverage — at Version 4

Reported by: warner Owned by:
Priority: normal Milestone: undecided
Component: code Version: 1.12.1
Keywords: Cc:
Launchpad Bug:

Description (last modified by warner)

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.

Change History (4)

comment:1 Changed at 2017-07-28T04:04:30Z by Brian Warner <warner@…>

In a4be2dc/trunk:

avoid variable coverage by using a defaultdict

refs ticket:2891

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:

dictutil: fix bug in str(ValueOrderedDict?), and improve test coverage

It looks like str() was meant to truncate the dict, but a missing i+=1 meant
that it never actually did. I also changed the format to include a clear
"..." in case we truncate it, to avoid confusion with a non-truncated dict of
the same size.

This also improves test coverage in subtract() and
NumDict?.item_with_largest_value().

refs ticket:2891

comment:4 Changed at 2017-08-10T18:41:50Z by warner

  • Description modified (diff)

fixed dictutil.py (lines 29, 230, 438) with [3f2f7df]

Note: See TracTickets for help on using tickets.