Skip to content

Commit

Permalink
use expectorate
Browse files Browse the repository at this point in the history
  • Loading branch information
karencfv committed Aug 28, 2024
1 parent e8bb7fe commit 16b2457
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clickhouse-admin/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ omicron-workspace-hack.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
expectorate.workspace = true
1 change: 1 addition & 0 deletions clickhouse-admin/types/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ impl KeeperConfigsForReplica {
// they must be wrapped in square brackets.
// Otherwise, when running any query, a "Service not found" error
// appears.
// https://github.com/ClickHouse/ClickHouse/blob/a011990fd75628c63c7995c4f15475f1d4125d10/src/Coordination/KeeperStateManager.cpp#L149
let parsed_host = match host.parse::<Ipv6Addr>() {
Ok(_) => format!("[{host}]"),
Err(_) => host.to_string(),
Expand Down
9 changes: 2 additions & 7 deletions clickhouse-admin/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,12 @@ mod tests {
let expected_file = Utf8PathBuf::from_str("./testutils")
.unwrap()
.join("keeper-config.xml");
let expected_content = std::fs::read_to_string(expected_file)
.expect("Failed to read from expected ClickHouse keeper file");
let generated_file =
Utf8PathBuf::from(config_dir.path()).join("keeper-config.xml");
let generated_content = std::fs::read_to_string(generated_file)
.expect("Failed to read from generated ClickHouse keeper file");

assert_eq!(expected_content, generated_content);
expectorate::assert_contents(expected_file, &generated_content);
}

#[test]
Expand Down Expand Up @@ -233,15 +231,12 @@ mod tests {
let expected_file = Utf8PathBuf::from_str("./testutils")
.unwrap()
.join("replica-server-config.xml");
let expected_content = std::fs::read_to_string(expected_file).expect(
"Failed to read from expected ClickHouse replica server file",
);
let generated_file = Utf8PathBuf::from(config_dir.path())
.join("replica-server-config.xml");
let generated_content = std::fs::read_to_string(generated_file).expect(
"Failed to read from generated ClickHouse replica server file",
);

assert_eq!(expected_content, generated_content);
expectorate::assert_contents(expected_file, &generated_content);
}
}

0 comments on commit 16b2457

Please sign in to comment.