test: add test_load_serde_yaml_v_0_8_config (#30558)

This commit is contained in:
Yihau Chen 2023-03-03 12:44:02 +08:00 committed by GitHub
parent 7b1d446001
commit 35427ee5a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 71 additions and 0 deletions

View File

@ -201,4 +201,75 @@ active_release_dir: {root_dir}/active_release
),
);
}
#[test]
fn test_load_serde_yaml_v_0_8_config() {
let file_name = "config.yml";
let mut file = File::create(file_name).unwrap();
defer! {
remove_file(file_name).unwrap();
}
let root_dir = "/home/sol/.local/share/solana/install";
writeln!(
file,
"---
json_rpc_url: \"http://api.devnet.solana.com\"
update_manifest_pubkey:
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
current_update_manifest: ~
update_poll_secs: 3600
explicit_release:
Semver: 1.13.6
releases_dir: {root_dir}/releases
active_release_dir: {root_dir}/active_release
"
)
.unwrap();
let config = Config::load(file_name).unwrap();
assert_eq!(
config,
Config {
json_rpc_url: String::from("http://api.devnet.solana.com"),
update_manifest_pubkey: Pubkey::default(),
current_update_manifest: None,
update_poll_secs: 3600,
explicit_release: Some(ExplicitRelease::Semver(String::from("1.13.6"))),
releases_dir: PathBuf::from(format!("{root_dir}/releases")),
active_release_dir: PathBuf::from(format!("{root_dir}/active_release")),
},
);
}
}