Skip to content

Commit

Permalink
GH-800: add test for the logs; all tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarshg6 committed Aug 27, 2024
1 parent 31db7c4 commit 4f8c141
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion node/src/proxy_client/stream_establisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ impl StreamEstablisher {
payload.target_port,
&self.logger,
)?;
// TODO: GH-800: Change it to a tokio channel instead of a crossbeam channel
let (shutdown_signal_tx, shutdown_signal_rx) = tokio::sync::mpsc::unbounded_channel();

self.spawn_stream_reader(
Expand Down
14 changes: 11 additions & 3 deletions node/src/proxy_client/stream_handler_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,13 @@ impl StreamHandlerPoolReal {
stream_key: &StreamKey,
logger: &Logger,
) {
// TODO: GH-800: Test Drive Me especially the logs
match reader_shutdown_tx.try_send(()) {
Ok(()) => {
debug!(logger, "A shutdown signal was sent.")
debug!(
logger,
"A shutdown signal was sent to the StreamReader for stream key {:?}.",
stream_key
);
}
Err(_e) => {
debug!(
Expand Down Expand Up @@ -1087,7 +1090,12 @@ mod tests {
let future_with_timeout =
tokio::timer::Timeout::new(future_result, Duration::from_secs(10)).into_future();
assert!(system.block_on(future_with_timeout).is_ok());
TestLogHandler::new().exists_log_containing(&format!(
let tlh = TestLogHandler::new();
tlh.exists_log_containing(&format!(
"DEBUG: {test_name}: A shutdown signal was sent to the StreamReader \
for stream key oUHoHuDKHjeWq+BJzBIqHpPFBQw."
));
tlh.exists_log_containing(&format!(
"DEBUG: {test_name}: Removing StreamWriter and Shutting down StreamReader \
for oUHoHuDKHjeWq+BJzBIqHpPFBQw to 3.4.5.6:80"
));
Expand Down
2 changes: 1 addition & 1 deletion node/tests/connection_shutdown_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn proxy_client_stream_reader_dies_when_client_stream_is_killed_integration() {

let write_error = server_write_error_rx
.recv_timeout(Duration::from_secs(60))
.unwrap(); // TODO: GH-800 We are failing on this timeout
.unwrap();
assert_eq!(write_error.kind(), io::ErrorKind::BrokenPipe);
join_handle.join().unwrap();
}
Expand Down

0 comments on commit 4f8c141

Please sign in to comment.