-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential improvements to mock_system
.
#183
Labels
fix/bug
Fixes errant behavior
Comments
mszulcz-mitre
added a commit
to mszulcz-mitre/opencbdc-tx
that referenced
this issue
Sep 26, 2022
The mock_system_test class has a few parts that could cause confusion. For example, the words 'module' and 'component' are used interchangeably, it's not clear when modules will be mocked, and it's not clear what the return value of start_servers means (see Issue mit-dci#183). This commit refactors the code to clarify these issues. Signed-off-by: Michael L. Szulczewski <[email protected]>
mszulcz-mitre
added a commit
to mszulcz-mitre/opencbdc-tx
that referenced
this issue
Sep 26, 2022
The mock_system class has a few parts that could cause confusion. For example, the words 'module' and 'component' are used interchangeably, it's not clear when modules will be mocked, and it's not clear what the return value of start_servers means (see Issue mit-dci#183). This commit refactors the code to clarify these issues. Signed-off-by: Michael L. Szulczewski <[email protected]>
I opened draft pull request #184 to address these issues. |
HalosGhost
pushed a commit
that referenced
this issue
Feb 21, 2023
The mock_system class has a few parts that could cause confusion. For example, the words 'module' and 'component' are used interchangeably, it's not clear when modules will be mocked, and it's not clear what the return value of start_servers means (see Issue #183). This commit refactors the code to clarify these issues. Signed-off-by: Michael L. Szulczewski <[email protected]>
via #184. |
HalosGhost
pushed a commit
to HalosGhost/opencbdc-tx
that referenced
this issue
Jul 6, 2023
The mock_system class has a few parts that could cause confusion. For example, the words 'module' and 'component' are used interchangeably, it's not clear when modules will be mocked, and it's not clear what the return value of start_servers means (see Issue mit-dci#183). This commit refactors the code to clarify these issues. Signed-off-by: Michael L. Szulczewski <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Affected Branch
trunk
Basic Diagnostics
I've pulled the latest changes on the affected branch and the issue is still present.
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
:opencbdc-tx/tests/integration/mock_system.hpp
Lines 79 to 82 in 4d82040
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.
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:opencbdc-tx/tests/integration/mock_system.hpp
Lines 50 to 52 in 4d82040
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 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:opencbdc-tx/tests/integration/mock_system.hpp
Lines 154 to 156 in 4d82040
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
The text was updated successfully, but these errors were encountered: