Role starter APIs on Integration Test framework is starting to slip into some fragmented patterns, which is resulting in a suboptimal user experience while writing tests.
Given that #1226 hasn't yet been merged, I believe it can be used to address start_jdc and start_jds.
But start_sniffer, start_pool and start_template_provider probably deserve a separate PR (ideally in sync with #1226).
Here's a detailed description of each fragmented pattern:
arg types
All starter functions take parameters with Socket Address information.
However, each role is following a different standard:
start_sniffer takes SocketAddr
start_pool takes Option<SocketAddr>
start_template_provider takes u16 (representing a port)
start_jdc takes SocketAddr (not yet merged, WIP under #1226)
start_jds takes SocketAddr (not yet merged, WIP under #1226)
assumptions on roles socket addresses
Not all starter functions are taking Socket Address information for the actual role.
start_sniffer assumes sniffer_addr will be provided by the user
start_pool assumes pool_addr will be provided by the user
start_template_provider assumes tp_addr will be provided by the user
start_jdc assumes nothing is provided, but calls common::get_available_address() inside the function body (not yet merged, WIP under #1226)
start_jds assumes nothing is provided, but calls common::get_available_address() inside the function body (not yet merged, WIP under #1226)
To be honest, I feel it makes more sense to always call common::get_available_address() inside the function bodies and simply abstract that away from the user (potentially even making common::get_available_address() into a private function under common).
In other words, I think the direction start_jdc and start_jds are taking is better than the other starters.
return types
Starter functions are returning types under different patterns:
start_sniffer returns Sniffer
start_pool returns PoolSv2
start_template_provider returns TemplateProvider
start_jdc returns SocketAddr (not yet merged, WIP under #1226)
start_jds returns SocketAddr (not yet merged, WIP under #1226)
Role starter APIs on Integration Test framework is starting to slip into some fragmented patterns, which is resulting in a suboptimal user experience while writing tests.
I noticed this while doing the experimentation described here: https://github.com/stratum-mining/stratum/pull/1226#issuecomment-2438910821
Given that #1226 hasn't yet been merged, I believe it can be used to address
start_jdc
andstart_jds
.But
start_sniffer
,start_pool
andstart_template_provider
probably deserve a separate PR (ideally in sync with #1226).Here's a detailed description of each fragmented pattern:
arg types
All starter functions take parameters with Socket Address information. However, each role is following a different standard:
start_sniffer
takesSocketAddr
start_pool
takesOption<SocketAddr>
start_template_provider
takesu16
(representing a port)start_jdc
takesSocketAddr
(not yet merged, WIP under #1226)start_jds
takesSocketAddr
(not yet merged, WIP under #1226)assumptions on roles socket addresses
Not all starter functions are taking Socket Address information for the actual role.
start_sniffer
assumessniffer_addr
will be provided by the userstart_pool
assumespool_addr
will be provided by the userstart_template_provider
assumestp_addr
will be provided by the userstart_jdc
assumes nothing is provided, but callscommon::get_available_address()
inside the function body (not yet merged, WIP under #1226)start_jds
assumes nothing is provided, but callscommon::get_available_address()
inside the function body (not yet merged, WIP under #1226)To be honest, I feel it makes more sense to always call
common::get_available_address()
inside the function bodies and simply abstract that away from the user (potentially even makingcommon::get_available_address()
into a private function undercommon
).In other words, I think the direction
start_jdc
andstart_jds
are taking is better than the other starters.return types
Starter functions are returning types under different patterns:
start_sniffer
returnsSniffer
start_pool
returnsPoolSv2
start_template_provider
returnsTemplateProvider
start_jdc
returnsSocketAddr
(not yet merged, WIP under #1226)start_jds
returnsSocketAddr
(not yet merged, WIP under #1226)