Skip to content
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

fix(node_manager): lowercase owner for discord #2188

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions sn_node_manager/src/add_services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ pub async fn add_node(
check_port_availability(port_option, &node_registry.nodes)?;
}

let owner = match &options.owner {
Some(owner) => Some(owner.to_lowercase()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we raise a warning here in case an UpperCase input detected ?

at least a warning log ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

None => None,
};

let safenode_file_name = options
.safenode_src_path
.file_name()
Expand Down Expand Up @@ -221,7 +226,7 @@ pub async fn add_node(
name: service_name.clone(),
node_ip: options.node_ip,
node_port,
owner: options.owner.clone(),
owner: owner.clone(),
rpc_socket_addr,
safenode_path: service_safenode_path.clone(),
service_user: options.user.clone(),
Expand Down Expand Up @@ -256,7 +261,7 @@ pub async fn add_node(
number: node_number,
reward_balance: None,
rpc_socket_addr,
owner: options.owner.clone(),
owner: owner.clone(),
peer_id: None,
pid: None,
safenode_path: service_safenode_path,
Expand Down
4 changes: 2 additions & 2 deletions sn_node_manager/src/add_services/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4066,7 +4066,7 @@ async fn add_node_should_add_the_node_with_upnp_enabled() -> Result<()> {
}

#[tokio::test]
async fn add_node_should_assign_an_owner() -> Result<()> {
async fn add_node_should_assign_an_owner_in_lowercase() -> Result<()> {
let tmp_data_dir = assert_fs::TempDir::new()?;
let node_reg_path = tmp_data_dir.child("node_reg.json");

Expand Down Expand Up @@ -4155,7 +4155,7 @@ async fn add_node_should_assign_an_owner() -> Result<()> {
local: false,
log_format: None,
metrics_port: None,
owner: Some("discord_username".to_string()),
owner: Some("Discord_Username".to_string()),
node_ip: None,
node_port: None,
rpc_address: None,
Expand Down
Loading