test:runtime: out_stackdriver: add test with log tag
@@ -3606,6 +3606,50 @@ void flb_test_resource_k8s_node_custom_k8s_regex_with_dot()
flb_destroy(ctx);
}
+void flb_test_resource_k8s_node_custom_k8s_regex_with_long_tag()
+{
+ int ret;
+ int size = sizeof(K8S_NODE_LOCAL_RESOURCE_ID_WITH_DOT) - 1;
+ flb_ctx_t *ctx;
+ int in_ffd;
+ int out_ffd;
+
+ /* Create context, flush every second (some checks omitted here) */
+ ctx = flb_create();
+ flb_service_set(ctx, "flush", "1", "grace", "1", NULL);
+
+ /* Lib input mode */
+ in_ffd = flb_input(ctx, (char *) "lib", NULL);
+ flb_input_set(ctx, in_ffd, "tag", "tagWithLongLen", NULL);
+
+ /* Stackdriver output */
+ out_ffd = flb_output(ctx, (char *) "stackdriver", NULL);
+ flb_output_set(ctx, out_ffd,
+ "match", "tagWithLongLen",
+ "resource", "k8s_node",
+ "google_service_credentials", SERVICE_CREDENTIALS,
+ "k8s_cluster_name", "test_cluster_name",
+ "k8s_cluster_location", "test_cluster_location",
+ "custom_k8s_regex", "^(?<node_name>.*)$",
+ NULL);
+
+ /* Enable test mode */
+ ret = flb_output_set_test(ctx, out_ffd, "formatter",
+ cb_check_k8s_node_custom_k8s_regex,
+ NULL, NULL);
+
+ /* Start */
+ ret = flb_start(ctx);
+ TEST_CHECK(ret == 0);
+
+ /* Ingest data sample */
+ flb_lib_push(ctx, in_ffd, (char *) K8S_NODE_LOCAL_RESOURCE_ID_WITH_DOT, size);
+
+ sleep(2);
+ flb_stop(ctx);
+ flb_destroy(ctx);
+}
+
void flb_test_resource_k8s_pod_no_local_resource_id()
{
int ret;
@@ -4714,6 +4758,7 @@ TEST_LIST = {
{"resource_k8s_node_common", flb_test_resource_k8s_node_common },
{"resource_k8s_node_no_local_resource_id", flb_test_resource_k8s_node_no_local_resource_id },
{"resource_k8s_node_custom_k8s_regex_with_dot", flb_test_resource_k8s_node_custom_k8s_regex_with_dot },
+ {"resource_k8s_node_custom_k8s_regex_with_long_tag", flb_test_resource_k8s_node_custom_k8s_regex_with_long_tag },
{"resource_k8s_pod_common", flb_test_resource_k8s_pod_common },
{"resource_k8s_pod_no_local_resource_id", flb_test_resource_k8s_pod_no_local_resource_id },
{"default_labels", flb_test_default_labels },
