diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:20:02 +0000 |
commit | 58daab21cd043e1dc37024a7f99b396788372918 (patch) | |
tree | 96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /fluent-bit/tests/runtime/http_callbacks.c | |
parent | Releasing debian version 1.43.2-1. (diff) | |
download | netdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz netdata-58daab21cd043e1dc37024a7f99b396788372918.zip |
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/tests/runtime/http_callbacks.c')
-rw-r--r-- | fluent-bit/tests/runtime/http_callbacks.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/fluent-bit/tests/runtime/http_callbacks.c b/fluent-bit/tests/runtime/http_callbacks.c new file mode 100644 index 000000000..76e1c5f3e --- /dev/null +++ b/fluent-bit/tests/runtime/http_callbacks.c @@ -0,0 +1,58 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#include <fluent-bit.h> +#include <fluent-bit/flb_http_client.h> + +#include "flb_tests_runtime.h" + +static void debug_cb_request_headers(char *name, void *p1, void *p2) +{ + struct flb_http_client *c = p1; + + fprintf(stderr, "[http] request headers\n%s", c->header_buf); +} + +void flb_test_http_callbacks() +{ + int ret; + flb_ctx_t *ctx; + int in_ffd; + int out_ffd; + + ctx = flb_create(); + TEST_CHECK(ctx != NULL); + + flb_service_set(ctx, + "Flush", "1", + "Grace", "5", + "Daemon", "false", + NULL); + + in_ffd = flb_input(ctx, (char *) "dummy", NULL); + flb_input_set(ctx, in_ffd, "samples", "1", NULL); + + out_ffd = flb_output(ctx, (char *) "http", NULL); + flb_output_set(ctx, out_ffd, + "match", "*", + "host", "google.com", + "port", "80", + "uri" , "/", + NULL); + + flb_output_set_callback(ctx, out_ffd, "_debug.http.request_headers", + debug_cb_request_headers); + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + sleep(5); + + flb_stop(ctx); + flb_destroy(ctx); + +} + +/* Test list */ +TEST_LIST = { + {"http_callbacks", flb_test_http_callbacks }, + {NULL, NULL} +}; |