Add non-standard-ports preset and test
This commit is contained in:
parent
4fea18d945
commit
b975efa2bb
10
parity/cli/presets/config.non-standard-ports.toml
Normal file
10
parity/cli/presets/config.non-standard-ports.toml
Normal file
@ -0,0 +1,10 @@
|
||||
# This config should be placed in following path:
|
||||
# $HOME/Library/Application Support/io.parity.ethereum/config.toml
|
||||
|
||||
[network]
|
||||
# Parity will listen for connections on port 30305.
|
||||
port = 30305
|
||||
|
||||
[rpc]
|
||||
# JSON-RPC over HTTP will be accessible on port 8645.
|
||||
port = 8645
|
@ -18,6 +18,7 @@ pub fn preset_config_string(arg: &str) -> Result<&'static str, &str> {
|
||||
match arg.to_lowercase().as_ref() {
|
||||
"dev" => Ok(include_str!("./config.dev.toml")),
|
||||
"mining" => Ok(include_str!("./config.mining.toml")),
|
||||
"non-standard-ports" => Ok(include_str!("./config.non-standard-ports.toml")),
|
||||
_ => Err(arg.clone())
|
||||
}
|
||||
}
|
@ -1616,6 +1616,31 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_non_standard_ports_preset() {
|
||||
let args = vec!["parity", "preset", "non-standard-ports"];
|
||||
let conf = Configuration::parse(&args, None).unwrap();
|
||||
match conf.into_command().unwrap().cmd {
|
||||
Cmd::Run(c) => {
|
||||
assert_eq!(c.net_settings.network_port, 30305);
|
||||
assert_eq!(c.net_settings.rpc_port, 8645);
|
||||
},
|
||||
_ => panic!("Should be Cmd::Run"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_override_preset() {
|
||||
let args = vec!["parity", "preset", "mining", "--min-peers=99"];
|
||||
let conf = Configuration::parse(&args, None).unwrap();
|
||||
match conf.into_command().unwrap().cmd {
|
||||
Cmd::Run(c) => {
|
||||
assert_eq!(c.net_conf.min_peers, 99);
|
||||
},
|
||||
_ => panic!("Should be Cmd::Run"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_apply_ports_shift() {
|
||||
// given
|
||||
|
Loading…
Reference in New Issue
Block a user