tests: runtime: filter_throttle: add test case for window 0
@@ -10,10 +10,12 @@ pthread_mutex_t result_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Test functions */
void flb_test_filter_throttle(void);
+void flb_test_filter_window_0(void);
/* Test list */
TEST_LIST = {
{"throttle", flb_test_filter_throttle },
+ {"window_0", flb_test_filter_window_0 },
{NULL, NULL}
};
@@ -68,3 +70,36 @@ void flb_test_filter_throttle(void)
flb_stop(ctx);
flb_destroy(ctx);
}
+
+void flb_test_filter_window_0(void)
+{
+ int ret;
+ flb_ctx_t *ctx;
+ int in_ffd;
+ int out_ffd;
+ int filter_ffd;
+
+ ctx = flb_create();
+
+ in_ffd = flb_input(ctx, (char *) "lib", NULL);
+ TEST_CHECK(in_ffd >= 0);
+ flb_input_set(ctx, in_ffd, "tag", "test", NULL);
+
+ out_ffd = flb_output(ctx, (char *) "stdout", NULL);
+ TEST_CHECK(out_ffd >= 0);
+ flb_output_set(ctx, out_ffd, "match", "test", NULL);
+
+ filter_ffd = flb_filter(ctx, (char *) "throttle", NULL);
+ TEST_CHECK(filter_ffd >= 0);
+ ret = flb_filter_set(ctx, filter_ffd, "match", "*",
+ "window", "0",
+ NULL);
+
+ ret = flb_start(ctx);
+ TEST_CHECK(ret == 0);
+
+ sleep(1); /* waiting flush */
+
+ flb_stop(ctx);
+ flb_destroy(ctx);
+}
