Closed matthawkins90 closed 3 weeks ago
I think that's a fair take, and yes in general I don't think it matters much. I had a few reasons for reorganizing this file in particular, though:
TestCorruptPeersFile
which I later renamed as TestLoadPeersWithCorruptPeersFile
was originally difficult for me to understand its purpose. All it calls is Start()
and Stop()
. But it's actually testing loadPeers
, that if the call to deserializePeers
fails, that loadPeers
will correctly delete the corrupt peers file. So to help myself understand what the test was trying to accomplish, I moved it to where loadPeers
is situated (near Start
and Stop
), renamed it, and added a test description. I dunno, it just makes sense to me to put similar tests near each other, and that sometimes calls for better organization.Should I squash this down to two commits?
Yes, please squash down to those 2. Should be good to go after that.
This PR is the first of more changes coming to Addrmgr.
However, in an attempt to create smaller PRs that are easier to review, this PR is simply increasing test coverage for the module without making any other changes.
The first commit has zero additions or subtractions--it's simply a reorganization to make the testfile easier to read and work on.
There are still multiple functions that don't have 100% test coverage, but in general those are unhittable cases. The only functions that I'm planning to increase coverage on (in a future PR) are
AddressCache
andnewAddressFromString
. Everything else I feel is covered to the best extent it can be.Coverage before:
Coverage after:
Details before:
Details after: