2025-12-31 04:02:25 +03:00
|
|
|
use anyhow::Result;
|
|
|
|
|
use integration_tests::TestContext;
|
|
|
|
|
use log::info;
|
|
|
|
|
use tokio::test;
|
|
|
|
|
use wallet::cli::{Command, config::ConfigSubcommand};
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
async fn modify_config_field() -> Result<()> {
|
|
|
|
|
let mut ctx = TestContext::new().await?;
|
|
|
|
|
|
2026-02-24 20:52:14 +03:00
|
|
|
let old_seq_poll_timeout = ctx.wallet().config().seq_poll_timeout;
|
2025-12-31 04:02:25 +03:00
|
|
|
|
|
|
|
|
// Change config field
|
|
|
|
|
let command = Command::Config(ConfigSubcommand::Set {
|
2026-02-24 20:52:14 +03:00
|
|
|
key: "seq_poll_timeout".to_string(),
|
|
|
|
|
value: "1s".to_string(),
|
2025-12-31 04:02:25 +03:00
|
|
|
});
|
|
|
|
|
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
|
|
|
|
|
|
2026-02-24 20:52:14 +03:00
|
|
|
let new_seq_poll_timeout = ctx.wallet().config().seq_poll_timeout;
|
|
|
|
|
assert_eq!(new_seq_poll_timeout, std::time::Duration::from_secs(1));
|
2025-12-31 04:02:25 +03:00
|
|
|
|
|
|
|
|
// Return how it was at the beginning
|
|
|
|
|
let command = Command::Config(ConfigSubcommand::Set {
|
2026-02-24 20:52:14 +03:00
|
|
|
key: "seq_poll_timeout".to_string(),
|
|
|
|
|
value: format!("{:?}", old_seq_poll_timeout),
|
2025-12-31 04:02:25 +03:00
|
|
|
});
|
|
|
|
|
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
|
|
|
|
|
|
|
|
|
|
info!("Successfully modified and restored config field");
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|