Skip to content

Commit 9ad9dca

Browse files
cosmo0920edsiper
authored andcommitted
tests: runtime: Add a test case for retaining metadata on upstream
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 6d2b920 commit 9ad9dca

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[UPSTREAM]
2+
name test_upstream
3+
4+
[NODE]
5+
name node-1
6+
host 127.0.0.1
7+
port 24224
8+
send_options true
9+
retain_metadata_in_forward_mode true

tests/runtime/group_counter_semantics.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,42 @@ static void flb_test_forward_group_size_retain_metadata()
699699
flb_destroy(ctx);
700700
}
701701

702+
static void flb_test_forward_group_size_retain_metadata_upstream_node()
703+
{
704+
int ret;
705+
int out_ffd;
706+
int in_ffd;
707+
flb_ctx_t *ctx;
708+
709+
reset_results();
710+
711+
ctx = flb_create();
712+
flb_service_set(ctx, "Flush", "0.2", "Grace", "1", "Log_Level", "error", NULL);
713+
714+
in_ffd = flb_input(ctx, (char *) "lib", NULL);
715+
TEST_CHECK(in_ffd >= 0);
716+
flb_input_set(ctx, in_ffd, "tag", "test", NULL);
717+
718+
out_ffd = flb_output(ctx, (char *) "forward", NULL);
719+
TEST_CHECK(out_ffd >= 0);
720+
flb_output_set(ctx, out_ffd,
721+
"match", "test",
722+
"tag", "new.tag",
723+
"upstream",
724+
FLB_TESTS_DATA_PATH "/data/forward/upstream_retain_metadata.conf",
725+
NULL);
726+
727+
ret = flb_output_set_test(ctx, out_ffd, "formatter",
728+
cb_forward_size_check,
729+
NULL, NULL);
730+
TEST_CHECK(ret == 0);
731+
732+
run_group_count_test(ctx);
733+
TEST_CHECK(get_forward_size() == 3);
734+
735+
flb_destroy(ctx);
736+
}
737+
702738
static void flb_test_loki_group_values_count()
703739
{
704740
int out_ffd;
@@ -838,6 +874,8 @@ static void flb_test_forward_output_processor_mixed_payload_smoke()
838874
TEST_LIST = {
839875
{"forward_group_size_default", flb_test_forward_group_size_default},
840876
{"forward_group_size_retain_metadata", flb_test_forward_group_size_retain_metadata},
877+
{"forward_group_size_retain_metadata_upstream_node",
878+
flb_test_forward_group_size_retain_metadata_upstream_node},
841879
{"loki_group_values_count", flb_test_loki_group_values_count},
842880
{"stackdriver_group_entries_count", flb_test_stackdriver_group_entries_count},
843881
{"forward_output_processor_mixed_payload_smoke",

0 commit comments

Comments
 (0)