-
Notifications
You must be signed in to change notification settings - Fork 127
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
Allow altering messages exchanged by roles in test env #1228
base: main
Are you sure you want to change the base?
Allow altering messages exchanged by roles in test env #1228
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1228 +/- ##
=======================================
Coverage 19.36% 19.36%
=======================================
Files 164 164
Lines 10811 10811
=======================================
Hits 2094 2094
Misses 8717 8717
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Bencher Report
Click to view all benchmark results
|
Bencher Report
Click to view all benchmark results
|
Bencher Report
Click to view all benchmark results
|
Handle scenario when TP responds with `SetupConnectionError` to a pool
Because we dont want to fail here, but rather fail when we assert the messages exchanged between the pool and TP(or others)
961caa7
to
bf97853
Compare
after discussing with @jbesraa on the call today, we will potentially pivot this approach towards adding a new primitive (aside to the |
(let's assume this new primitive will be called
this stack is represented as a as discussed in the call, here's a dummy test (pseudocode) that could be used to drive the development of this new primitive, at least from a conceptual perspective the scenario here is:
#[tokio::test]
async fn test_tp_mock_setup_connection_error() {
let mock_tp_addr = common::get_available_address();
let sniffer_addr = common::get_available_address();
let pool_addr = common::get_available_address();
let mock_tp_expected_setup_connection = ...
let mock_tp_response_setup_connection_error = ...
let mock_tp_message_pair = (mock_tp_expected_setup_connection, mock_tp_response_setup_connection_error);
// this is a very simple test where we only have one pair
// but the generic case could have multiple pairs
// the order of each (expected, response) pair within the Vec is also important
let mock_tp_message_pair_vec = vec![mock_tp_message_pair];
let mut mock = common::start_mock(mock_tp_addr, mock_tp_message_pair_vec).await;
let sniffer = common::start_sniffer(sniffer_addr, mock_tp_addr).await;
let pool = common::start_pool(Some(pool_addr), Some(sniffer_addr)).await;
assert_common_message!(&sniffer.next_downstream_message(), SetupConnection);
// this specific assertion is essentially proving that mock_tp is behaving as expected
assert_common_message!(&sniffer.next_upstream_message(), SetupConnectionError);
// here it could be interesting to assert the internal state of pool after receiveing SetupConnectionError
// but essentially this is somewhat outside of the scope of this PR, since we just want to add a new primitive to the IT framework and not necessarily improve testing around the pool role implementation
// if this assertion proves too challenging, it can be left for some future work
} |
resolves #1227