Skip to content

Commit b40779c

Browse files
Devdutt Shenoinikhilsinhaparseable
authored andcommitted
test: fix expectation
1 parent 96dd957 commit b40779c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/handlers/http/logstream.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,9 @@ pub mod error {
572572

573573
#[cfg(test)]
574574
mod tests {
575-
use crate::handlers::http::modal::utils::logstream_utils::PutStreamHeaders;
575+
use crate::{
576+
event::format::LogSource, handlers::http::modal::utils::logstream_utils::PutStreamHeaders,
577+
};
576578
use actix_web::test::TestRequest;
577579

578580
// TODO: Fix this test with routes
@@ -597,7 +599,7 @@ mod tests {
597599
async fn header_without_log_source() {
598600
let req = TestRequest::default().to_http_request();
599601
let PutStreamHeaders { log_source, .. } = req.headers().into();
600-
assert_eq!(log_source, crate::event::format::LogSource::Json);
602+
assert_eq!(log_source, LogSource::Json);
601603
}
602604

603605
#[actix_web::test]
@@ -606,19 +608,19 @@ mod tests {
606608
.insert_header(("X-P-Log-Source", "pmeta"))
607609
.to_http_request();
608610
let PutStreamHeaders { log_source, .. } = req.headers().into();
609-
assert_eq!(log_source, crate::event::format::LogSource::Pmeta);
611+
assert_eq!(log_source, LogSource::Pmeta);
610612

611613
req = TestRequest::default()
612614
.insert_header(("X-P-Log-Source", "otel-logs"))
613615
.to_http_request();
614616
let PutStreamHeaders { log_source, .. } = req.headers().into();
615-
assert_eq!(log_source, crate::event::format::LogSource::OtelLogs);
617+
assert_eq!(log_source, LogSource::OtelLogs);
616618

617619
req = TestRequest::default()
618620
.insert_header(("X-P-Log-Source", "kinesis"))
619621
.to_http_request();
620622
let PutStreamHeaders { log_source, .. } = req.headers().into();
621-
assert_eq!(log_source, crate::event::format::LogSource::Kinesis);
623+
assert_eq!(log_source, LogSource::Kinesis);
622624
}
623625

624626
#[actix_web::test]
@@ -627,6 +629,9 @@ mod tests {
627629
.insert_header(("X-P-Log-Source", "teststream"))
628630
.to_http_request();
629631
let PutStreamHeaders { log_source, .. } = req.headers().into();
630-
assert_eq!(log_source, crate::event::format::LogSource::Json);
632+
matches!(
633+
log_source,
634+
LogSource::Custom(src) if src == "teststream"
635+
);
631636
}
632637
}

0 commit comments

Comments
 (0)