Skip to content

Commit 99b68bf

Browse files
Syther007Bertutkarshg6bertllll
authored
GH-651: Automatic Retries for the URLs in case of DNS Resolve Failure (#326)
* GH-651: we identified the appropriate place for the new logic * GH-651: added in a missing Zero hop test * GH-651: add todos for this card * GH-651: repaired current tests * GH-651: Added IBCDHelperReal factory * GH-651: worked on test: handle_dns_resolve_failure_sent_request_retry * GH-651: Before master merge * GH-651: Repaired master meage * GH-651: Testing is working but stil failing * GH-651: Test is now working * GH-651: Added some more Cassertions * GH-651: Test is now working as expected * GH-651: Added new macro: type_id * GH-651: Fixed RouteQueryMessage stop condition * GH-651: started work on stop_on_message * GH-651: Finished stop_on_message * GH-651: Added retiring stream key code to test * GH-651: Working on improving request_route_and_transmit * GH-651: Changes from Dev meeting * GH-651: Fixed a test for error log case * GH-651: Fixed all tests * GH-651: Added a todo * GH-651: Removed dns_failure_retries after exhausting its retry count * GH-651: Added function dns_failure_retries_left * GH-651: Refactored handle_dns_resolve_failure function * GH-651: Remove return from request_route_and_transmit * GH-651: Formatting * GH-651: renamed stream_shutdown_sub to dispatcher_sub * GH-651: more renaming * GH-651: created send_dns_failure_response_to_the_browser function * GH-651: Updated dns_resolution_failure_response message * GH-651: Added todo * GH-651: Added a new message DnsRetryResultMessage under ProxyServer * GH-651: implement Ok result for DnsRetryResultMessage * GH-651: Fixed some tests * GH-651: Refactored resolve_message * GH-651: Fixed test resolve_message_handles_mailbox_error_from_neighborhood * GH-651: Refactored proxy_server/mod.rs * GH-651: Removed AddRouteMessage * GH-651: Renamed DnsRetryResultMessage to RouteResultMessage * GH-651: Added TODOs for next session * GH-651: Added new struct Hostname * GH-651: Add new test new_http_request_creates_new_entry_inside_dns_retries_hashmap * GH-651: complete test new_http_request_creates_new_entry_inside_dns_retries_hashmap * GH-651: Fixed todos and added a new test * GH-651: Added test proxy_server_receives_failed_dns_then_a_successful_cores_package * GH-651: Remove test proxy_server_receives_failed_dns_then_a_successful_cores_package * GH-651: Ceanup - tests passing * GH-651: Fixed test dns_resolution_failure_no_longer_blacklists_exit_node_for_all_hosts * GH-651: Added test dns_resolution_failure_automatic_retries_works * Added new test dns_resolution_failure_with_real_nodes * GH-651: Working on test: dns_resolution_failure_with_real_nodes_route_error * GH-651: Test dns_resolution_failure_with_real_nodes_route_error is working * GH-651: Added new enum MessageTypeLite with test * GH-651: added new function: wait_for_specific_package * GH-651: added new function: make_package_for_client * GH-651: Refactoring / cleanup * GH-651: fixed routes for function make_package_for_client * GH-651: Removed test: dns_resolution_failure_automatic_retries_works * GH-651: fixing test dns_resolution_failure_no_longer_blacklists_exit_node_for_all_hosts * GH-651: working on dns_resolution_failure_no_longer_blacklists_exit_node_for_all_hosts * GH-651: Finished test: dns_resolution_failure_no_longer_blacklists_exit_node_for_all_hosts * GH-651: added new logs RouteResultMessage handler * GH-651: Added new test: route_result_message_handler_panics_when_dns_retries_hashmap_doesnt_contain_a_stream_key * GH-651: Formatting * GH-651: Removed warnings * GH-651: ci-matrix multinode_integration_test DEBUG * GH-651: Increased timeouts * GH-651: Increased Node count for test dns_resolution_failure_with_real_nodes * GH-651: Increase timeout for test dns_resolution_failure_with_real_nodes * GH-651: changed timeout for test dns_resolution_failure_with_real_nodes * GH-651: added removal of DNS retry entry on a successful client responce & clean up * GH-651: test clean up * GH-651: More clean up * GH-651: Finished self review * GH651: added modity_config closure to construct_neighborhood * GH-651: formatting * GH-651: Working on review 1 * GH-651: More work completed for review 1 * GH651: Completed more items form review 1 * GH651: Completed more items form review 1 * GH651: Completed more items form review 1 * GH651: Completed more items form review 1 * GH-651: Clean up of peer_actors.proxy_server * GH-651 Formatting * GH651: Improved TryTransmitToHopperArgs::New * GH-651: added new test new_http_request_creates_new_exhausted_entry_inside_dns_retries_hashmap_zero_hop * GH-651: Simple Renaming * GH-651: Added condition to test: handle_dns_resolve_failure_sends_message_to_neighborhood * GH-651: Fixed System new name * GH-651: Removed zsh text * GH-651: Merged in Master * GH-651: doubious test fixed * GH-651: Removed test proxy_server_applies_late_wallet_information * GH-651: Added new test fn dns_resolution_failure_for_wildcard_ip_with_real_nodes * GH-651: Added new test wildcard_ip_resolves_in_dns_failure * GH-651: Sends DnsResolveFailure_0v1 for DNS failure & wildcard IP * GH-651: fixed test dns_resolution_failure_for_wildcard_ip_with_real_nodes * GH-651: Ignoring test actual_server_drop * GH-651: IP wildcard filter added with test --------- Co-authored-by: Bert <[email protected]> Co-authored-by: utkarshg6 <[email protected]> Co-authored-by: Bert <[email protected]>
1 parent d529207 commit 99b68bf

18 files changed

+2046
-513
lines changed

multinode_integration_tests/src/masq_mock_node.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ use node_lib::sub_lib::cryptde::{encodex, CryptDE};
1919
use node_lib::sub_lib::cryptde_null::CryptDENull;
2020
use node_lib::sub_lib::cryptde_real::CryptDEReal;
2121
use node_lib::sub_lib::framer::Framer;
22-
use node_lib::sub_lib::hopper::{IncipientCoresPackage, MessageType};
22+
use node_lib::sub_lib::hopper::{
23+
ExpiredCoresPackage, IncipientCoresPackage, MessageType, MessageTypeLite,
24+
};
2325
use node_lib::sub_lib::neighborhood::{GossipFailure_0v1, RatePack, DEFAULT_RATE_PACK};
2426
use node_lib::sub_lib::node_addr::NodeAddr;
2527
use node_lib::sub_lib::route::Route;
@@ -394,6 +396,32 @@ impl MASQMockNode {
394396
Ok((socket_from, socket_to, live_cores_package))
395397
}
396398

399+
pub fn wait_for_specific_package(
400+
&self,
401+
message_type_lite: MessageTypeLite,
402+
immediate_neighbor: SocketAddr,
403+
) -> Option<ExpiredCoresPackage<MessageType>> {
404+
let public_key = self.main_public_key();
405+
let cryptde = CryptDENull::from(public_key, TEST_DEFAULT_MULTINODE_CHAIN);
406+
loop {
407+
if let Ok((_, _, live_cores_package)) =
408+
self.wait_for_package(&JsonMasquerader::new(), Duration::from_secs(2))
409+
{
410+
let (_, intended_exit_public_key) =
411+
CryptDENull::extract_key_pair(public_key.len(), &live_cores_package.payload);
412+
assert_eq!(&intended_exit_public_key, public_key);
413+
let expired_cores_package = live_cores_package
414+
.to_expired(immediate_neighbor, &cryptde, &cryptde)
415+
.unwrap();
416+
if message_type_lite == expired_cores_package.payload.clone().into() {
417+
return Some(expired_cores_package);
418+
}
419+
} else {
420+
return None;
421+
}
422+
}
423+
}
424+
397425
pub fn wait_for_gossip(&self, timeout: Duration) -> Option<(Gossip_0v1, IpAddr)> {
398426
let masquerader = JsonMasquerader::new();
399427
match self.wait_for_package(&masquerader, timeout) {

multinode_integration_tests/src/neighborhood_constructor.rs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use crate::masq_mock_node::MASQMockNode;
44
use crate::masq_node::MASQNode;
55
use crate::masq_node_cluster::MASQNodeCluster;
6-
use crate::masq_real_node::MASQRealNode;
76
use crate::masq_real_node::{make_consuming_wallet_info, NodeStartupConfigBuilder};
7+
use crate::masq_real_node::{MASQRealNode, NodeStartupConfig};
88
use crate::multinode_gossip::{Standard, StandardBuilder};
99
use node_lib::neighborhood::gossip::Gossip_0v1;
1010
use node_lib::neighborhood::gossip_producer::{GossipProducer, GossipProducerReal};
@@ -51,25 +51,28 @@ use std::time::Duration;
5151
/// * `HashMap<PublicKey, MASQMockNode>` The mock Nodes corresponding to other NodeRecords in `model_db`. They
5252
/// will have the same public keys as the `model_db` NodeRecords they
5353
/// represent, but different NodeAddrs.
54-
pub fn construct_neighborhood(
54+
pub fn construct_neighborhood<F>(
5555
cluster: &mut MASQNodeCluster,
5656
model_db: NeighborhoodDatabase,
5757
additional_keys_to_mock: Vec<&PublicKey>,
58+
modify_config: F,
5859
) -> (
5960
NeighborhoodDatabase,
6061
MASQRealNode,
6162
HashMap<PublicKey, MASQMockNode>,
62-
) {
63-
let real_node = cluster.start_real_node(
64-
NodeStartupConfigBuilder::standard()
65-
.fake_public_key(model_db.root().public_key())
66-
.consuming_wallet_info(make_consuming_wallet_info(
67-
model_db.root().public_key().to_string().as_str(),
68-
))
69-
.rate_pack(model_db.root().inner.rate_pack)
70-
.chain(cluster.chain)
71-
.build(),
72-
);
63+
)
64+
where
65+
F: FnOnce(NodeStartupConfigBuilder) -> NodeStartupConfig,
66+
{
67+
let config_builder = NodeStartupConfigBuilder::standard()
68+
.fake_public_key(model_db.root().public_key())
69+
.consuming_wallet_info(make_consuming_wallet_info(
70+
model_db.root().public_key().to_string().as_str(),
71+
))
72+
.rate_pack(model_db.root().inner.rate_pack)
73+
.chain(cluster.chain);
74+
let config = modify_config(config_builder);
75+
let real_node = cluster.start_real_node(config);
7376
let (mock_node_map, adjacent_mock_node_keys) =
7477
make_mock_node_map(cluster, &model_db, &real_node, additional_keys_to_mock);
7578
let modified_nodes = make_modified_node_records(model_db, &mock_node_map);
@@ -82,6 +85,10 @@ pub fn construct_neighborhood(
8285
(modified_db, real_node, mock_node_map)
8386
}
8487

88+
pub fn do_not_modify_config() -> impl FnOnce(NodeStartupConfigBuilder) -> NodeStartupConfig {
89+
|builder: NodeStartupConfigBuilder| builder.build()
90+
}
91+
8592
fn make_mock_node_map(
8693
cluster: &mut MASQNodeCluster,
8794
model_db: &NeighborhoodDatabase,

0 commit comments

Comments
 (0)