swarm-builder: let the helper test tolerate epipe like git does
This commit is contained in:
parent
04cffe7957
commit
f03dcd0f31
1 changed files with 7 additions and 3 deletions
|
|
@ -346,11 +346,15 @@ mod tests {
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("sh runs");
|
.expect("sh runs");
|
||||||
write!(
|
// The helper exits without reading the request for any op but `get`,
|
||||||
|
// so the write can hit EPIPE. `git` ignores EPIPE here too.
|
||||||
|
let written = write!(
|
||||||
child.stdin.take().expect("piped"),
|
child.stdin.take().expect("piped"),
|
||||||
"protocol={protocol}\nhost={host}\npath=agent-configs/atlas\n\n"
|
"protocol={protocol}\nhost={host}\npath=agent-configs/atlas\n\n"
|
||||||
)
|
);
|
||||||
.expect("the helper reads its request");
|
if let Err(e) = written {
|
||||||
|
assert_eq!(e.kind(), std::io::ErrorKind::BrokenPipe, "{e}");
|
||||||
|
}
|
||||||
let out = child.wait_with_output().expect("the helper exits");
|
let out = child.wait_with_output().expect("the helper exits");
|
||||||
assert!(out.status.success());
|
assert!(out.status.success());
|
||||||
String::from_utf8(out.stdout).expect("utf-8")
|
String::from_utf8(out.stdout).expect("utf-8")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue