[bisq-network/bisq] (9/9) [PR COMMENTS] Split up P2PDataStoreTest (#3587)

Julian Knutsen notifications at github.com
Sat Nov 9 19:18:02 UTC 2019


New commits start 269f8c7

Review of #3554 asked for some iteration on the number of different tests that all existed in one file. To that end, this PR splits up the tests into multiple files, cleans up the common helper functions, and adds Javadoc comments on all of the test fixtures to help future reviewers understand how the tests work.

I would prefer to just put this PR on the end of the rest since it is strictly limited to test code. That will save a lot of the hassle of having to merge the various iterations of tests throughout the refactor effort across the new files.

I think the end result is in a good place and there is a clean separation between the common test helpers and the various entry points.
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/3587

-- Commit Summary --

  * [TESTS] Add tests for P2PDataStorage in order to safely refactor
  * [BUGFIX] Call correct remove function in addMailboxData failure path.
  * [REFACTOR] P2PDataStorage::addPersistableNetworkPayload()
  * [REFACTOR] P2PDataStorage::addProtectedStorageEntry()
  * [REFACTOR] P2PDataStorage::refreshTTL()
  * [REFACTOR] P2PDataStorage::remove()
  * [REFACTOR] P2PDataStorage::removeMailboxData()
  * Update behavior of P2PDataStorage::addProtectedStorageEntry() on duplicates
  * Update behavior of P2PDataStorage::refreshTTL() on duplicates
  * Update behavior of P2PDataStorage::remove() & removeMailboxData() on duplicate sequence #s
  * [PR COMMENTS] Don't use the real Alert class
  * Merge branch 'add-tests' into fix-remove-bug
  * [PR COMMENTS] Don't call removeMailboxData in addMailboxData failure path
  * Merge branch 'fix-remove-bug' into refactor-add-remove-refresh
  * [PR COMMENTS] Clean up logging messages
  * Merge branch 'refactor-add-remove-refresh' into update-duplicate-behavior
  * [TESTS] Reduce concurrent failure tests to 2 concurrent operations instead of 3
  * Merge branch 'master' into add-tests
  * [PR COMMENTS] Use Client API in comments
  * Merge branch 'add-tests' into fix-remove-bug
  * [PR COMMENTS] Remove concurrent tests
  * Merge branch 'fix-remove-bug' into refactor-add-remove-refresh
  * [PR COMMENTS] Use "Client API" in transient comments
  * Merge branch 'refactor-add-remove-refresh' into update-duplicate-behavior
  * Use dependency injected Clock in P2PDataStore
  * [REFACTOR] Clean up ProtectedStorageEntry ctor
  * Add Clock parameter to ProtectedStorageEntry
  * Use Clock instead of System in ProtectedStorageEntry
  * [TESTS] Use ClockFake in tests to control time
  * [TESTS] Test onBootstrapComplete()
  * [TESTS] Lower entries required for purge in tests
  * [PR COMMENTS] Don't store Clock in ProtectedStorageEntry
  * Merge branch 'master' into add-tests
  * Merge branch 'add-tests' into fix-remove-bug
  * Merge branch 'fix-remove-bug' into refactor-add-remove-refresh
  * Merge branch 'refactor-add-remove-refresh' into update-duplicate-behavior
  * Merge branch 'update-duplicate-behavior' into manual-clock-in-tests
  * [REFACTOR] Remove duplicated code in refreshTTL
  * [TESTS] Add more tests around mis-wrapped ProtectedStorageEntrys
  * [REFACTOR] ProtectedStorageEntry::validForAddOperation()
  * [REFACTOR] ProtectedStorageEntry::isValidForRemoveOperation()
  * [REFACTOR] Remove checkPublicKeys()
  * Clean up toString() methods
  * [REFACTOR] Move signature validation behind isValidForAddOperation()
  * [REFACTOR] Move signature validation behind isValidForRemoveOperation()
  * [REFACTOR] Move receiversPubKey check behind isValidForRemoveOperation()
  * Remove duplicate check in refreshTTL
  * Introduce isMetadataEquals and use it
  * [TESTS] Update remove validation with BroadcastMessage type
  * Combine remove() and removeMailboxData()
  * [TESTS] Start deprecating integrations tests
  * [TESTS] Remove dead tests and code
  * [DEAD CODE] Remove unused functions and imports
  * [DEAD CODE] Remove obsolete tests
  * [PR COMMENTS] Add JavaDocs for test objects
  * [TESTS] Split monolithic P2PDataStoreTest into separate files
  * [TESTS] Clean up TestState static methods
  * [TESTS] Make SavedTestState ctor private to TestState
  * [TESTS] Add missing license text to test files
  * [TESTS] Rename P2PDataStoreTest

-- File Changes --

    M common/src/main/java/bisq/common/proto/network/NetworkProtoResolver.java (4)
    M core/src/main/java/bisq/core/proto/CoreProtoResolver.java (6)
    M core/src/main/java/bisq/core/proto/network/CoreNetworkProtoResolver.java (5)
    M monitor/src/main/java/bisq/monitor/metric/P2PNetworkLoad.java (6)
    M monitor/src/main/java/bisq/monitor/metric/P2PSeedNodeSnapshotBase.java (4)
    M p2p/src/main/java/bisq/network/p2p/P2PService.java (12)
    M p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java (454)
    M p2p/src/main/java/bisq/network/p2p/storage/payload/ProtectedMailboxStorageEntry.java (161)
    M p2p/src/main/java/bisq/network/p2p/storage/payload/ProtectedStorageEntry.java (183)
    M p2p/src/test/java/bisq/network/p2p/TestUtils.java (5)
    D p2p/src/test/java/bisq/network/p2p/storage/ObsoleteP2PDataStorageTest.java (217)
    A p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageClientAPITest.java (242)
    A p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageOnMessageHandlerTest.java (101)
    A p2p/src/test/java/bisq/network/p2p/storage/P2PDataStoragePersistableNetworkPayloadTest.java (195)
    A p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageProtectedStorageEntryTest.java (629)
    A p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageRemoveExpiredTest.java (182)
    D p2p/src/test/java/bisq/network/p2p/storage/P2PDataStorageTest.java (28)
    A p2p/src/test/java/bisq/network/p2p/storage/P2PDataStoreDisconnectTest.java (170)
    D p2p/src/test/java/bisq/network/p2p/storage/ProtectedDataStorageTest.java (229)
    A p2p/src/test/java/bisq/network/p2p/storage/TestState.java (373)
    M p2p/src/test/java/bisq/network/p2p/storage/messages/AddDataMessageTest.java (4)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/AppendOnlyDataStoreServiceFake.java (48)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/ClockFake.java (54)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/DateTolerantPayloadStub.java (57)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/ExpirableProtectedStoragePayloadStub.java (59)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/PersistableExpirableProtectedStoragePayloadStub.java (40)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/PersistableNetworkPayloadStub.java (50)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/ProtectedDataStoreServiceFake.java (51)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/ProtectedStoragePayloadStub.java (68)
    A p2p/src/test/java/bisq/network/p2p/storage/payload/ProtectedMailboxStorageEntryTest.java (202)
    A p2p/src/test/java/bisq/network/p2p/storage/payload/ProtectedStorageEntryTest.java (216)
    A p2p/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker (1)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/3587.patch
https://github.com/bisq-network/bisq/pull/3587.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3587
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191109/2627a850/attachment-0001.html>


More information about the bisq-github mailing list