From 4d0f688ccf0d6763d30ae8bcb01f51ef7317e5af Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Tue, 29 Oct 2024 15:29:27 +0700 Subject: [PATCH] Add test case for handle batch --- test/uplink/metrics/pipeline_test.exs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/uplink/metrics/pipeline_test.exs b/test/uplink/metrics/pipeline_test.exs index cc80158..b3a190e 100644 --- a/test/uplink/metrics/pipeline_test.exs +++ b/test/uplink/metrics/pipeline_test.exs @@ -116,4 +116,16 @@ defmodule Uplink.Metrics.PipelineTest do assert not is_nil(load_15) end + + test "handle batch", %{ + message_with_previous_cpu_metric: message1, + message_with_previous_network_metric: message2 + } do + ref = Broadway.test_batch(Uplink.Metrics.Pipeline, [message1, message2]) + + assert_receive {:ack, ^ref, successful, failed}, 10_000 + + assert length(successful) == 2 + assert length(failed) == 0 + end end