Skip to content

Commit 618a8e8

Browse files
committed
test: update batch nofitier handling
1 parent 7388902 commit 618a8e8

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/sinks/http/tests.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use vector_lib::codecs::{
1212
encoding::{Framer, FramingConfig},
1313
JsonSerializerConfig, NewlineDelimitedEncoderConfig, TextSerializerConfig,
1414
};
15-
1615
use vector_lib::event::{BatchNotifier, BatchStatus, Event, LogEvent};
16+
use vector_lib::finalization::AddBatchNotifier;
1717

1818
use crate::{
1919
assert_downcast_matches,
@@ -695,19 +695,20 @@ async fn missing_field_in_uri_template() {
695695
let (rx, trigger, server) = build_test_server(in_addr);
696696

697697
let (batch, mut receiver) = BatchNotifier::new_with_receiver();
698-
let event = Event::Log(LogEvent::default()).with_batch_notifier(&batch);
698+
let mut event = Event::Log(LogEvent::default());
699+
event.add_batch_notifier(batch);
699700

700701
tokio::spawn(server);
701702

702703
sink.run_events([event]).await.unwrap();
703704

704705
drop(trigger);
705706

706-
// TODO: Currently, When the KeyPartitioner fails to build the batch key from
707+
// TODO(https://github.com/vectordotdev/vector/issues/23366): Currently, When the KeyPartitioner fails to build the batch key from
707708
// an event, the finalizer is not notified with
708709
// EventStatus::Rejected. The error is silently ignored.
709710
// See src/sinks/http/sink.rs:47
710-
assert!(matches!(receiver.try_recv(), Err(_)));
711+
assert_eq!(receiver.try_recv(), Ok(BatchStatus::Delivered));
711712

712713
// No requests should have been made to the server
713714
let requests = rx.collect::<Vec<_>>().await;
@@ -736,19 +737,16 @@ async fn http_uri_auth_conflict() {
736737
let (rx, trigger, server) = build_test_server(in_addr);
737738

738739
let (batch, mut receiver) = BatchNotifier::new_with_receiver();
739-
let event = Event::Log(LogEvent::default()).with_batch_notifier(&batch);
740+
let mut event = Event::Log(LogEvent::default());
741+
event.add_batch_notifier(batch);
740742

741743
tokio::spawn(server);
742744

743745
sink.run_events([event]).await.unwrap();
744746

745747
drop(trigger);
746748

747-
// TODO: Currently, When the request builder fails to build a request from
748-
// an event/batch of events, the finalizer is not notified with
749-
// EventStatus::Rejected. The error is silently ignored
750-
// See src/sinks/http/sink.rs:54
751-
assert!(matches!(receiver.try_recv(), Err(_)));
749+
assert_eq!(receiver.try_recv(), Ok(BatchStatus::Rejected));
752750

753751
// No requests should have been made to the server
754752
let requests = rx.collect::<Vec<_>>().await;

0 commit comments

Comments
 (0)