@@ -3606,6 +3606,50 @@ void flb_test_resource_k8s_node_custom_k8s_regex_with_dot()
36063606 flb_destroy (ctx );
36073607}
36083608
3609+ void flb_test_resource_k8s_node_custom_k8s_regex_with_long_tag ()
3610+ {
3611+ int ret ;
3612+ int size = sizeof (K8S_NODE_LOCAL_RESOURCE_ID_WITH_DOT ) - 1 ;
3613+ flb_ctx_t * ctx ;
3614+ int in_ffd ;
3615+ int out_ffd ;
3616+
3617+ /* Create context, flush every second (some checks omitted here) */
3618+ ctx = flb_create ();
3619+ flb_service_set (ctx , "flush" , "1" , "grace" , "1" , NULL );
3620+
3621+ /* Lib input mode */
3622+ in_ffd = flb_input (ctx , (char * ) "lib" , NULL );
3623+ flb_input_set (ctx , in_ffd , "tag" , "tagWithLongLen" , NULL );
3624+
3625+ /* Stackdriver output */
3626+ out_ffd = flb_output (ctx , (char * ) "stackdriver" , NULL );
3627+ flb_output_set (ctx , out_ffd ,
3628+ "match" , "tagWithLongLen" ,
3629+ "resource" , "k8s_node" ,
3630+ "google_service_credentials" , SERVICE_CREDENTIALS ,
3631+ "k8s_cluster_name" , "test_cluster_name" ,
3632+ "k8s_cluster_location" , "test_cluster_location" ,
3633+ "custom_k8s_regex" , "^(?<node_name>.*)$" ,
3634+ NULL );
3635+
3636+ /* Enable test mode */
3637+ ret = flb_output_set_test (ctx , out_ffd , "formatter" ,
3638+ cb_check_k8s_node_custom_k8s_regex ,
3639+ NULL , NULL );
3640+
3641+ /* Start */
3642+ ret = flb_start (ctx );
3643+ TEST_CHECK (ret == 0 );
3644+
3645+ /* Ingest data sample */
3646+ flb_lib_push (ctx , in_ffd , (char * ) K8S_NODE_LOCAL_RESOURCE_ID_WITH_DOT , size );
3647+
3648+ sleep (2 );
3649+ flb_stop (ctx );
3650+ flb_destroy (ctx );
3651+ }
3652+
36093653void flb_test_resource_k8s_pod_no_local_resource_id ()
36103654{
36113655 int ret ;
@@ -4714,6 +4758,7 @@ TEST_LIST = {
47144758 {"resource_k8s_node_common" , flb_test_resource_k8s_node_common },
47154759 {"resource_k8s_node_no_local_resource_id" , flb_test_resource_k8s_node_no_local_resource_id },
47164760 {"resource_k8s_node_custom_k8s_regex_with_dot" , flb_test_resource_k8s_node_custom_k8s_regex_with_dot },
4761+ {"resource_k8s_node_custom_k8s_regex_with_long_tag" , flb_test_resource_k8s_node_custom_k8s_regex_with_long_tag },
47174762 {"resource_k8s_pod_common" , flb_test_resource_k8s_pod_common },
47184763 {"resource_k8s_pod_no_local_resource_id" , flb_test_resource_k8s_pod_no_local_resource_id },
47194764 {"default_labels" , flb_test_default_labels },
0 commit comments