Skip to content

Commit f5fe7c2

Browse files
committed
Log the cluster logfile on error.
1 parent c010455 commit f5fe7c2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

redis/tests/support/cluster.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ impl RedisCluster {
206206

207207
match process.try_wait() {
208208
Ok(Some(status)) => {
209+
209210
let stdout = process.stdout.map_or(String::new(), |mut out|{
210211
let mut str = String::new();
211212
out.read_to_string(&mut str).unwrap();
@@ -219,7 +220,10 @@ impl RedisCluster {
219220
let err =
220221
format!("redis server creation failed with status {status:?}.\nstdout: `{stdout}`.\nstderr: `{stderr}`");
221222
if cur_attempts == max_attempts {
222-
panic!("{err}");
223+
let log_file_index = cmd.get_args().position(|os_str| os_str == "--logfile").unwrap() + 1;
224+
let log_file_path = cmd.get_args().skip(log_file_index).next().unwrap();
225+
let contents = std::fs::read_to_string(log_file_path).unwrap();
226+
panic!("{err} - logfile: {contents}");
223227
}
224228
eprintln!("Retrying: {err}");
225229
cur_attempts += 1;

0 commit comments

Comments
 (0)