Skip to content

Commit

Permalink
[test]: cover absolute paths
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Balashov <[email protected]>
  • Loading branch information
0x009922 committed Feb 16, 2024
1 parent e76bc79 commit c075c85
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
24 changes: 23 additions & 1 deletion config/tests/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{

use eyre::Result;
use iroha_config::parameters::{
actual::Root,
actual::{Genesis, Root},
user::{CliContext, RootPartial},
};
use iroha_config_base::{FromEnv, TestEnv, UnwrapPartial as _};
Expand Down Expand Up @@ -491,3 +491,25 @@ fn full_config_parses_fine() {
)
.expect("should be fine");
}

#[test]
fn absolute_paths_are_preserved() {
let cfg = Root::load(
Some(fixtures_dir().join("absolute_paths.toml")),
CliContext {
submit_genesis: true,
},
)
.expect("should be fine");

assert_eq!(cfg.kura.store_dir, PathBuf::from("/kura/store"));
assert_eq!(cfg.snapshot.store_dir, PathBuf::from("/snapshot/store"));
assert_eq!(
cfg.dev_telemetry.unwrap().out_file,
PathBuf::from("/telemetry/file.json")
);
let Genesis::Full {
file: genesis_file, ..
} = cfg.genesis else { unreachable!() };
assert_eq!(genesis_file, PathBuf::from("/oh/my/genesis.json"));
}
14 changes: 14 additions & 0 deletions config/tests/fixtures/absolute_paths.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends = ["base.toml"]

[kura]
store_dir = "/kura/store"

[snapshot]
store_dir = "/snapshot/store"

[telemetry.dev]
out_file = "/telemetry/file.json"

[genesis]
file = "/oh/my/genesis.json"
private_key = { digest_function = "ed25519", payload = "8f4c15e5d664da3f13778801d23d4e89b76e94c1b94b389544168b6cb894f84f8ba62848cf767d72e7f7f4b9d2d7ba07fee33760f79abe5597a51520e292a0cb" }

0 comments on commit c075c85

Please sign in to comment.