[X] I've pulled the latest changes on the affected branch and the issue is still present.
[X] The issue is reproducible in docker
Description
The mock_system class “Establishes dummy listeners for each enabled system component” such as a watchtower, atomizer, or sentinel. It’s used in many of the integration tests. I think it’s an extremely useful class, but when using it for the first few times, I got confused about some things. I think the code could modified a little to make the class a little clearer.
I can't see any value in using both terms, so it seems reasonable to just use the word “module” since it’s already used more frequently in variable names in the class.
However, even if a module is enabled, it still won’t get mocked if its endpoints aren’t specified in the options struct. This is understandable, but makes code difficult to debug because it happens without warning. For example, according to the disabled modules set, the coordinator module should be mocked in the following tests, but isn’t because endpoints aren’t given: watchtower_integration_test, sentinel_integration_test, replicated_atomizer_integration_tests, replicated_shard_integration_tests, watchtower_integration_test, atomizer_raft_integration_test. In the sentinel_2pc_integration_test, the sentinel module itself is the only module in the disabled_modules set, but 4 of the remaining 5 possible modules do not get mocked because their endpoints aren’t given.
Affected Branch
trunk
Basic Diagnostics
[X] I've pulled the latest changes on the affected branch and the issue is still present.
[X] The issue is reproducible in docker
Description
The
mock_system
class “Establishes dummy listeners for each enabled system component” such as a watchtower, atomizer, or sentinel. It’s used in many of the integration tests. I think it’s an extremely useful class, but when using it for the first few times, I got confused about some things. I think the code could modified a little to make the class a little clearer.Components or modules?
Sometimes the things that are mocked are called components; sometimes they’re called modules. This might be confusing to a new user. For example, when looking at the signature of the
expect
method, the variablesfor_module
andcomponent_id
appear, and it’s not obvious thatcomponent_id
is an ID of the specifiedfor_module
: https://github.com/mit-dci/opencbdc-tx/blob/4d82040c58142aec263a6e293b2664ec140141f6/tests/integration/mock_system.hpp#L79-L82I can't see any value in using both terms, so it seems reasonable to just use the word “module” since it’s already used more frequently in variable names in the class.
When’s a module disabled?
It’s not always obvious what modules will be mocked. By default, the class mocks all modules in the
m_modules
set and requires the user to specify what modules not to mock by passing them to the constructor in thedisabled_modules
set: https://github.com/mit-dci/opencbdc-tx/blob/4d82040c58142aec263a6e293b2664ec140141f6/tests/integration/mock_system.hpp#L50-L52However, even if a module is enabled, it still won’t get mocked if its endpoints aren’t specified in the
options
struct. This is understandable, but makes code difficult to debug because it happens without warning. For example, according to the disabled modules set, the coordinator module should be mocked in the following tests, but isn’t because endpoints aren’t given:watchtower_integration_test
,sentinel_integration_test
,replicated_atomizer_integration_tests
,replicated_shard_integration_tests
,watchtower_integration_test
,atomizer_raft_integration_test
. In thesentinel_2pc_integration_test
, the sentinel module itself is the only module in thedisabled_modules
set, but 4 of the remaining 5 possible modules do not get mocked because their endpoints aren’t given.What does the return value of
start_servers
mean?The method
start_servers
attempts to start a listening server for a given module and returns a boolean: https://github.com/mit-dci/opencbdc-tx/blob/4d82040c58142aec263a6e293b2664ec140141f6/tests/integration/mock_system.hpp#L154-L156 As written, it returns true for both of these conditions:disabled_modules
set or because no endpoints for the module were given.Having the method return
true
even if servers aren’t started is a little confusing.Code of Conduct