Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,24 @@ private void exec(String pod, Object... messages) {
}

/**
* Answers the exec of {@link #cmdProbe} with {@code messages} and then a status frame.
* Answers the exec of {@link #cmdProbe} with {@code messages} and then a status frame, and leaves
* the stream open: the client closes it once it has read the status.
*
* <p>Exec status is emitted last; a small wait keeps websocket close from racing it.
* <p>The mock closes a stream as soon as no message is pending, and it queues the messages one at a
* time, so it could close after sending the first, before the status was queued (1 run in 1,000). A
* client message it waits for, which never comes, keeps it from closing.
*/
private void execWithStatus(String pod, int exitCode, Object... messages) {
server.expect()
.get()
.withPath(execPath(pod))
.andUpgradeToWebSocket()
.open(messages)
.waitFor(50)
.immediately()
.andEmit(new StatusStreamMessage(exitCode))
.expect("never sent")
.andEmit("unused")
.always()
.done()
.always();
}
Expand Down
Loading