Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion USER-INTERFACE-INTERFACE.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ This command can be used in two ways which can't be combined:
1. If we use the command with showCountries set to true.
2. If we want to set an exit location.

In case 1. it retrieves information about the available countries in our neighborhood. In this case, other parameters are
In case 1. it retrieves information about the available countries in our neighborhood. Other parameters are
ignored.

In case 2. we must set showCountries to false and then configure fallbackRouting and exitLocations with our preferences.
Expand Down
26 changes: 21 additions & 5 deletions masq/src/commands/exit_location_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,6 @@ pub mod tests {

#[test]
fn providing_show_countries_with_country_codes_fails() {
let result_expected = "cannot be used with one or more of the other specified arguments\n\nUSAGE:\n";

let result = SetExitLocationCommand::new(&[
"exit-location".to_string(),
"--show-countries".to_string(),
Expand All @@ -501,30 +499,48 @@ pub mod tests {
])
.unwrap_err();

let result_expected =
"cannot be used with one or more of the other specified arguments\n\nUSAGE:\n";
let expected_one = "show-countries";
let expected_two = "country-codes";
assert!(
result.contains(result_expected),
"result was {:?}, but expected {:?}",
result,
result_expected,
);
assert!(
result.contains(expected_one) || result.contains(expected_two),
"result was not containing neither of those {:?}, nor {:?}",
expected_one,
expected_two,
);
}

#[test]
fn providing_show_countries_with_fallback_routing_fails() {
let result_expected = "cannot be used with one or more of the other specified arguments\n\nUSAGE:\n";

let result = SetExitLocationCommand::new(&[
"exit-location".to_string(),
"--show-countries".to_string(),
"--fallback-routing".to_string(),
])
.unwrap_err();
.unwrap_err();

let result_expected =
"cannot be used with one or more of the other specified arguments\n\nUSAGE:\n";
let expected_one = "show-countries";
let expected_two = "fallback-routing";
assert!(
result.contains(result_expected),
"result was {:?}, but expected {:?}",
result,
result_expected,
);
assert!(
result.contains(expected_one) || result.contains(expected_two),
"result was not containing neither of those {:?}, nor {:?}",
expected_one,
expected_two,
);
}
}
2 changes: 1 addition & 1 deletion multinode_integration_tests/src/multinode_gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
use crate::masq_node::MASQNode;
use masq_lib::blockchains::chains::Chain;
use masq_lib::test_utils::utils::TEST_DEFAULT_MULTINODE_CHAIN;
use node_lib::neighborhood::gossip::AccessibleGossipRecord;
use node_lib::neighborhood::gossip::{GossipNodeRecord, Gossip_0v1};
use node_lib::neighborhood::AccessibleGossipRecord;
use node_lib::sub_lib::cryptde::PublicKey;
use node_lib::sub_lib::cryptde_null::CryptDENull;
use node_lib::test_utils::vec_to_set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use crate::masq_node_cluster::MASQNodeCluster;
use crate::masq_real_node::{make_consuming_wallet_info, NodeStartupConfigBuilder};
use crate::masq_real_node::{MASQRealNode, NodeStartupConfig};
use crate::multinode_gossip::{Standard, StandardBuilder};
use node_lib::neighborhood::gossip::AccessibleGossipRecord;
use node_lib::neighborhood::gossip::Gossip_0v1;
use node_lib::neighborhood::gossip_producer::{GossipProducer, GossipProducerReal};
use node_lib::neighborhood::neighborhood_database::NeighborhoodDatabase;
use node_lib::neighborhood::node_record::{NodeRecord, NodeRecordMetadata};
use node_lib::neighborhood::AccessibleGossipRecord;
use node_lib::sub_lib::cryptde::PublicKey;
use node_lib::sub_lib::utils::time_t_timestamp;
use node_lib::test_utils::neighborhood_test_utils::db_from_node;
Expand Down
2 changes: 1 addition & 1 deletion multinode_integration_tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use node_lib::database::db_initializer::{
};
use node_lib::database::rusqlite_wrappers::ConnectionWrapper;
use node_lib::db_config::config_dao::{ConfigDao, ConfigDaoReal};
use node_lib::neighborhood::gossip::AccessibleGossipRecord;
use node_lib::neighborhood::node_location::get_node_location;
use node_lib::neighborhood::node_record::NodeRecordInner_0v1;
use node_lib::neighborhood::AccessibleGossipRecord;
use node_lib::sub_lib::cryptde::{CryptData, PlainData};
use std::collections::BTreeSet;
use std::io::{ErrorKind, Read, Write};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use multinode_integration_tests_lib::masq_real_node::{
};
use multinode_integration_tests_lib::neighborhood_constructor::construct_neighborhood;
use node_lib::json_masquerader::JsonMasquerader;
use node_lib::neighborhood::gossip::AccessibleGossipRecord;
use node_lib::neighborhood::neighborhood_database::NeighborhoodDatabase;
use node_lib::neighborhood::node_record::NodeRecord;
use node_lib::neighborhood::AccessibleGossipRecord;
use node_lib::sub_lib::cryptde::{CryptDE, PublicKey};
use node_lib::sub_lib::cryptde_null::CryptDENull;
use node_lib::sub_lib::hopper::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use multinode_integration_tests_lib::multinode_gossip::{
use multinode_integration_tests_lib::neighborhood_constructor::{
construct_neighborhood, do_not_modify_config,
};
use node_lib::neighborhood::gossip::AccessibleGossipRecord;
use node_lib::neighborhood::gossip::GossipBuilder;
use node_lib::neighborhood::neighborhood_database::NeighborhoodDatabase;
use node_lib::neighborhood::node_record::NodeRecord;
use node_lib::neighborhood::AccessibleGossipRecord;
use node_lib::sub_lib::cryptde::PublicKey;
use node_lib::sub_lib::neighborhood::GossipFailure_0v1;
use node_lib::test_utils::neighborhood_test_utils::{db_from_node, make_node_record};
Expand Down
11 changes: 5 additions & 6 deletions node/src/neighborhood/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ mod tests {
use super::super::gossip::GossipBuilder;
use super::*;
use crate::test_utils::neighborhood_test_utils::{
db_from_node, make_node_record, make_node_record_f,
db_from_node, make_node_record, make_node_record_cc, make_node_record_f,
};
use crate::test_utils::{assert_string_contains, vec_to_btset};
use std::str::FromStr;
Expand Down Expand Up @@ -671,7 +671,7 @@ mod tests {

#[test]
fn gossip_node_record_is_debug_formatted_to_be_human_readable() {
let node = make_node_record(1234, true);
let node = make_node_record_cc(1234, true, "AU");
let mut db = db_from_node(&node);
db.root_mut().increment_version();
db.root_mut().increment_version();
Expand Down Expand Up @@ -737,12 +737,11 @@ Length: 4 (0x4) bytes

#[test]
fn to_dot_graph_returns_gossip_in_dotgraph_format() {
let mut source_node = make_node_record(1234, true);
let mut source_node = make_node_record_cc(1234, true, "AU");
source_node.inner.public_key = PublicKey::new(&b"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[..]);
let mut target_node = make_node_record(2345, true);
let mut target_node = make_node_record_cc(2345, true, "FR");
target_node.inner.public_key = PublicKey::new(&b"ZYXWVUTSRQPONMLKJIHGFEDCBA"[..]);
let mut neighbor = make_node_record(3456, false);
neighbor.inner.country_code_opt = Some("FR".to_string());
let neighbor = make_node_record_cc(3456, false, "FR");
let mut db = db_from_node(&source_node);
db.add_node(target_node.clone()).unwrap();
db.add_node(neighbor.clone()).unwrap();
Expand Down
16 changes: 7 additions & 9 deletions node/src/neighborhood/gossip_acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1429,8 +1429,8 @@ mod tests {
use crate::sub_lib::utils::time_t_timestamp;
use crate::test_utils::neighborhood_test_utils::{
db_from_node, gossip_about_nodes_from_database, linearly_connect_nodes,
make_meaningless_db, make_node_record, make_node_record_f, make_node_records,
public_keys_from_node_records, DB_PATCH_SIZE_FOR_TEST,
make_meaningless_db, make_node_record, make_node_record_cc, make_node_record_f,
make_node_records, public_keys_from_node_records, DB_PATCH_SIZE_FOR_TEST,
};
use crate::test_utils::unshared_test_utils::make_cpm_recipient;
use crate::test_utils::{assert_contains, main_cryptde, vec_to_set};
Expand Down Expand Up @@ -1751,11 +1751,9 @@ mod tests {
.unwrap();

let (dest_public_key, dest_node_addr) = match counter_debut {
GossipAcceptanceResult::Reply(
_,
ref dest_public_key,
ref dest_node_addr,
) => (dest_public_key, dest_node_addr),
GossipAcceptanceResult::Reply(_, ref dest_public_key, ref dest_node_addr) => {
(dest_public_key, dest_node_addr)
}
x => panic!("Expected Reply, got {:?}", x),
};
assert_eq!(dest_public_key, new_debutant.public_key());
Expand Down Expand Up @@ -2442,8 +2440,8 @@ mod tests {
let src_root = make_node_record(1234, true);
let dest_root = make_node_record(2345, true);
let mut src_db = db_from_node(&src_root);
let node_a_fr = make_node_record(5678, true);
let node_b_us = make_node_record(4567, true);
let node_a_fr = make_node_record_cc(5678, true, "FR");
let node_b_us = make_node_record_cc(4567, true, "US");
let mut dest_db = db_from_node(&dest_root);
dest_db.add_node(src_root.clone()).unwrap();
dest_db.add_arbitrary_full_neighbor(dest_root.public_key(), src_root.public_key());
Expand Down
3 changes: 1 addition & 2 deletions node/src/neighborhood/gossip_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ mod tests {

#[test]
fn produce_debut_creates_a_gossip_to_a_target_about_ourselves_when_accepting_connections() {
let mut our_node_record: NodeRecord = make_node_record(7771, true);
our_node_record.inner.country_code_opt = Some("US".to_string());
let our_node_record: NodeRecord = make_node_record(7771, true);
let db = db_from_node(&our_node_record);
let subject = GossipProducerReal::new();

Expand Down
Loading