diff --git a/plugins/out_stackdriver/stackdriver.c b/plugins/out_stackdriver/stackdriver.c index 1375ba2c463..c0b7e26136e 100644 --- a/plugins/out_stackdriver/stackdriver.c +++ b/plugins/out_stackdriver/stackdriver.c @@ -1768,6 +1768,48 @@ static int pack_payload(int insert_id_extracted, return ret; } +/* + * should_skip_record + * Check if a record should be skipped due to invalid fields. + * Returns FLB_TRUE if the record should be dropped. + * + * log_errors: if FLB_TRUE, log why the record is being dropped. + * Set to FLB_FALSE during prescan to avoid duplicate logging. + */ +static int should_skip_record(struct flb_stackdriver *ctx, + msgpack_object *obj, + int log_errors) +{ + insert_id_status in_status; + msgpack_object insert_id_obj; + msgpack_object *payload_labels_ptr; + + /* Check insertId */ + in_status = validate_insert_id(&insert_id_obj, obj); + if (in_status == INSERTID_INVALID) { + if (log_errors == FLB_TRUE) { + flb_plg_error(ctx->ins, + "Incorrect insertId received. " + "InsertId should be non-empty string."); + } + return FLB_TRUE; + } + + /* Check labels type */ + payload_labels_ptr = get_payload_labels(ctx, obj); + if (payload_labels_ptr != NULL && + payload_labels_ptr->type != MSGPACK_OBJECT_MAP) { + if (log_errors == FLB_TRUE) { + flb_plg_error(ctx->ins, + "the type of payload labels should be map, " + "dropping record"); + } + return FLB_TRUE; + } + + return FLB_FALSE; +} + static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx, int total_records, const char *tag, int tag_len, @@ -1868,20 +1910,14 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx, } /* - * Search each entry and validate insertId. - * Reject the entry if insertId is invalid. + * Search each entry and validate record fields. + * Reject entries with invalid insertId or non-map labels. * If all the entries are rejected, stop formatting. - * */ while ((ret = flb_log_event_decoder_next( &log_decoder, &log_event)) == FLB_EVENT_DECODER_SUCCESS) { - /* Extract insertId */ - in_status = validate_insert_id(&insert_id_obj, log_event.body); - - if (in_status == INSERTID_INVALID) { - flb_plg_error(ctx->ins, - "Incorrect insertId received. InsertId should be non-empty string."); + if (should_skip_record(ctx, log_event.body, FLB_FALSE) == FLB_TRUE) { array_size -= 1; } } @@ -1890,6 +1926,9 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx, /* Sounds like this should compare to -1 instead of zero */ if (array_size == 0) { + flb_plg_warn(ctx->ins, + "all %d entries skipped due to invalid insertId " + "or labels, dropping batch", total_records); return NULL; } @@ -2308,6 +2347,12 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx, &log_decoder, &log_event)) == FLB_EVENT_DECODER_SUCCESS) { obj = log_event.body; + + /* Skip records with invalid fields */ + if (should_skip_record(ctx, obj, FLB_TRUE) == FLB_TRUE) { + continue; + } + tms_status = extract_timestamp(obj, &log_event.timestamp); /* @@ -2372,33 +2417,14 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx, log_name_extracted = FLB_TRUE; } - /* Extract insertId */ + /* Extract insertId (INVALID case already handled by should_skip_record) */ in_status = validate_insert_id(&insert_id_obj, obj); if (in_status == INSERTID_VALID) { insert_id_extracted = FLB_TRUE; entry_size += 1; } - else if (in_status == INSERTID_NOT_PRESENT) { - insert_id_extracted = FLB_FALSE; - } else { - if (trace_extracted == FLB_TRUE) { - flb_sds_destroy(trace); - } - - if (span_id_extracted == FLB_TRUE) { - flb_sds_destroy(span_id); - } - - if (project_id_extracted == FLB_TRUE) { - flb_sds_destroy(project_id_key); - } - - if (log_name_extracted == FLB_TRUE) { - flb_sds_destroy(log_name); - } - - continue; + insert_id_extracted = FLB_FALSE; } /* Extract operation */ @@ -2441,37 +2467,8 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx, entry_size += 1; } - /* Extract payload labels */ + /* Extract payload labels (non-map case already handled by should_skip_record) */ payload_labels_ptr = get_payload_labels(ctx, obj); - if (payload_labels_ptr != NULL && - payload_labels_ptr->type != MSGPACK_OBJECT_MAP) { - flb_plg_error(ctx->ins, "the type of payload labels should be map"); - flb_sds_destroy(operation_id); - flb_sds_destroy(operation_producer); - flb_sds_destroy(source_location_file); - flb_sds_destroy(source_location_function); - - if (trace_extracted == FLB_TRUE) { - flb_sds_destroy(trace); - } - - if (span_id_extracted == FLB_TRUE) { - flb_sds_destroy(span_id); - } - - if (project_id_extracted == FLB_TRUE) { - flb_sds_destroy(project_id_key); - } - - if (log_name_extracted == FLB_TRUE) { - flb_sds_destroy(log_name); - } - - flb_log_event_decoder_destroy(&log_decoder); - msgpack_sbuffer_destroy(&mp_sbuf); - - return NULL; - } /* Number of parsed labels */ labels_size = mk_list_size(&ctx->config_labels); diff --git a/tests/runtime/data/stackdriver/stackdriver_batch_all_labels_not_a_map.log b/tests/runtime/data/stackdriver/stackdriver_batch_all_labels_not_a_map.log new file mode 100644 index 00000000000..f48d662aa65 --- /dev/null +++ b/tests/runtime/data/stackdriver/stackdriver_batch_all_labels_not_a_map.log @@ -0,0 +1,2 @@ +{"message":"bad record 1", "logging.googleapis.com/labels": "not_a_map"} +{"message":"bad record 2", "logging.googleapis.com/labels": 12345} diff --git a/tests/runtime/data/stackdriver/stackdriver_batch_first_record_labels_not_a_map.log b/tests/runtime/data/stackdriver/stackdriver_batch_first_record_labels_not_a_map.log new file mode 100644 index 00000000000..83d389fbba8 --- /dev/null +++ b/tests/runtime/data/stackdriver/stackdriver_batch_first_record_labels_not_a_map.log @@ -0,0 +1,2 @@ +{"message":"bad first record", "logging.googleapis.com/labels": "not_a_map"} +{"message":"valid second record"} diff --git a/tests/runtime/data/stackdriver/stackdriver_batch_labels_not_a_map.log b/tests/runtime/data/stackdriver/stackdriver_batch_labels_not_a_map.log new file mode 100644 index 00000000000..90ea7737d4b --- /dev/null +++ b/tests/runtime/data/stackdriver/stackdriver_batch_labels_not_a_map.log @@ -0,0 +1,3 @@ +{"message":"valid record with labels", "logging.googleapis.com/labels": {"testA": "valA", "testB": "valB"}} +{"message":"bad labels - not a map", "logging.googleapis.com/labels": "not_a_map"} +{"message":"valid record without labels"} diff --git a/tests/runtime/data/stackdriver/stackdriver_batch_mixed_errors.log b/tests/runtime/data/stackdriver/stackdriver_batch_mixed_errors.log new file mode 100644 index 00000000000..e492242a3fd --- /dev/null +++ b/tests/runtime/data/stackdriver/stackdriver_batch_mixed_errors.log @@ -0,0 +1,4 @@ +{"message":"valid record no special fields"} +{"message":"bad insertId", "logging.googleapis.com/insertId": 123} +{"message":"bad labels", "logging.googleapis.com/labels": "not_a_map"} +{"message":"valid record with labels", "logging.googleapis.com/labels": {"testA": "valA"}} diff --git a/tests/runtime/data/stackdriver/stackdriver_test_labels.h b/tests/runtime/data/stackdriver/stackdriver_test_labels.h index ec3d80b3a5f..1199af66e53 100644 --- a/tests/runtime/data/stackdriver/stackdriver_test_labels.h +++ b/tests/runtime/data/stackdriver/stackdriver_test_labels.h @@ -42,3 +42,75 @@ "}" \ "}]" +/* labels value is a string instead of a map - should cause record to be dropped */ +#define LABELS_NOT_A_MAP "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/labels\": \"not_a_map\"" \ + "}]" + +/* custom labels key with string value instead of map */ +#define LABELS_NOT_A_MAP_CUSTOM_KEY "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/customlabels\": \"not_a_map\"" \ + "}]" + +/* invalid labels record with extracted fields (httpRequest, operation, */ +/* sourceLocation, trace, spanId) to verify cleanup on skip path */ +#define LABELS_NOT_A_MAP_WITH_FIELDS "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/labels\": \"not_a_map\"," \ + "\"logging.googleapis.com/trace\": \"test_trace\"," \ + "\"logging.googleapis.com/spanId\": \"test_span\"," \ + "\"logging.googleapis.com/operation\": " \ + "{" \ + "\"id\": \"test_id\"," \ + "\"producer\": \"test_producer\"," \ + "\"first\": true," \ + "\"last\": true" \ + "}," \ + "\"logging.googleapis.com/sourceLocation\": " \ + "{" \ + "\"file\": \"test_file\"," \ + "\"line\": 123," \ + "\"function\": \"test_function\"" \ + "}," \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"requestMethod\": \"GET\"," \ + "\"requestUrl\": \"https://example.com\"," \ + "\"status\": 200" \ + "}" \ + "}]" + +/* two-record batch: first record has invalid labels, second is valid */ +#define BATCH_FIRST_RECORD_LABELS_NOT_A_MAP "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/labels\": \"not_a_map\"," \ + "\"message\": \"bad first record\"" \ + "}]" + +#define BATCH_FIRST_RECORD_VALID "[" \ + "1591649196," \ + "{" \ + "\"message\": \"valid second record\"" \ + "}]" + +/* all records have invalid labels */ +#define BATCH_ALL_LABELS_NOT_A_MAP_1 "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/labels\": \"not_a_map\"," \ + "\"message\": \"bad record 1\"" \ + "}]" + +#define BATCH_ALL_LABELS_NOT_A_MAP_2 "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/labels\": 12345," \ + "\"message\": \"bad record 2\"" \ + "}]" + diff --git a/tests/runtime/out_stackdriver.c b/tests/runtime/out_stackdriver.c index 2bd79f31aaf..a73ce573e84 100644 --- a/tests/runtime/out_stackdriver.c +++ b/tests/runtime/out_stackdriver.c @@ -1381,6 +1381,125 @@ static void cb_check_default_labels_k8s_resource_type(void *ctx, int ffd, flb_sds_destroy(res_data); } +static void cb_check_labels_not_a_map(void *ctx, int ffd, + int res_ret, void *res_data, size_t res_size, + void *data) +{ + /* single record with labels as string should produce no output */ + TEST_CHECK(res_size == 0); + + flb_sds_destroy(res_data); +} + +static void cb_check_batch_labels_not_a_map(void *ctx, int ffd, + int res_ret, void *res_data, size_t res_size, + void *data) +{ + int ret; + + /* record 0 has valid labels */ + ret = mp_kv_exists(res_data, res_size, "$entries[0]['labels']"); + TEST_CHECK(ret == FLB_TRUE); + + ret = mp_kv_cmp(res_data, res_size, "$entries[0]['labels']['testA']", "valA"); + TEST_CHECK(ret == FLB_TRUE); + + ret = mp_kv_cmp(res_data, res_size, "$entries[0]['labels']['testB']", "valB"); + TEST_CHECK(ret == FLB_TRUE); + + /* record 1 (originally record 2) has no labels */ + ret = mp_kv_exists(res_data, res_size, "$entries[1]['labels']"); + TEST_CHECK(ret == FLB_FALSE); + + /* record 1 should have the message from the third input record */ + ret = mp_kv_cmp(res_data, res_size, + "$entries[1]['jsonPayload']['message']", + "valid record without labels"); + TEST_CHECK(ret == FLB_TRUE); + + /* there should be no entry at index 2 (the bad record was dropped) */ + ret = mp_kv_exists(res_data, res_size, "$entries[2]"); + TEST_CHECK(ret == FLB_FALSE); + + flb_sds_destroy(res_data); +} + +static void cb_check_batch_mixed_errors(void *ctx, int ffd, + int res_ret, void *res_data, size_t res_size, + void *data) +{ + int ret; + + /* record 0: valid record with no special fields */ + ret = mp_kv_cmp(res_data, res_size, + "$entries[0]['jsonPayload']['message']", + "valid record no special fields"); + TEST_CHECK(ret == FLB_TRUE); + + /* record 1: valid record with labels (originally record 3) */ + ret = mp_kv_exists(res_data, res_size, "$entries[1]['labels']"); + TEST_CHECK(ret == FLB_TRUE); + + ret = mp_kv_cmp(res_data, res_size, "$entries[1]['labels']['testA']", "valA"); + TEST_CHECK(ret == FLB_TRUE); + + /* there should be no entry at index 2 (2 out of 4 records dropped) */ + ret = mp_kv_exists(res_data, res_size, "$entries[2]"); + TEST_CHECK(ret == FLB_FALSE); + + flb_sds_destroy(res_data); +} + +static void cb_check_labels_not_a_map_custom_key(void *ctx, int ffd, + int res_ret, void *res_data, size_t res_size, + void *data) +{ + /* single record with custom labels key as string should produce no output */ + TEST_CHECK(res_size == 0); + + flb_sds_destroy(res_data); +} + +static void cb_check_batch_first_record_labels_not_a_map(void *ctx, int ffd, + int res_ret, void *res_data, size_t res_size, + void *data) +{ + int ret; + + /* first record was dropped, only the valid second record remains */ + ret = mp_kv_cmp(res_data, res_size, + "$entries[0]['jsonPayload']['message']", + "valid second record"); + TEST_CHECK(ret == FLB_TRUE); + + /* there should be no second entry */ + ret = mp_kv_exists(res_data, res_size, "$entries[1]"); + TEST_CHECK(ret == FLB_FALSE); + + flb_sds_destroy(res_data); +} + +static void cb_check_labels_not_a_map_with_fields(void *ctx, int ffd, + int res_ret, void *res_data, size_t res_size, + void *data) +{ + /* single record with invalid labels + many extracted fields */ + /* exercises the skip path with extracted fields present */ + TEST_CHECK(res_size == 0); + + flb_sds_destroy(res_data); +} + +static void cb_check_batch_all_labels_not_a_map(void *ctx, int ffd, + int res_ret, void *res_data, size_t res_size, + void *data) +{ + /* all records have invalid labels, should produce no output */ + TEST_CHECK(res_size == 0); + + flb_sds_destroy(res_data); +} + static void cb_check_resource_labels_one_field(void *ctx, int ffd, int res_ret, void *res_data, size_t res_size, void *data) { @@ -5150,6 +5269,303 @@ void flb_test_custom_labels_k8s_resource_type() flb_destroy(ctx); } +void flb_test_labels_not_a_map() +{ + int ret; + int size = sizeof(LABELS_NOT_A_MAP) - 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", "test", NULL); + + /* Stackdriver output */ + out_ffd = flb_output(ctx, (char *) "stackdriver", NULL); + flb_output_set(ctx, out_ffd, + "match", "test", + "resource", "gce_instance", + NULL); + + /* Enable test mode */ + ret = flb_output_set_test(ctx, out_ffd, "formatter", + cb_check_labels_not_a_map, + NULL, NULL); + + /* Start */ + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + /* Ingest data sample */ + flb_lib_push(ctx, in_ffd, (char *) LABELS_NOT_A_MAP, size); + + sleep(2); + flb_stop(ctx); + flb_destroy(ctx); +} + +void flb_test_batch_labels_not_a_map() +{ + int ret; + flb_ctx_t *ctx; + int in_ffd; + int out_ffd; + + /* Create context, flush every second (some checks omitted here) */ + ctx = flb_create(); + ret = flb_service_set(ctx, "flush", "1", "grace", "1", NULL); + TEST_CHECK_(ret == 0, "setting service options"); + + /* Tail input mode */ + in_ffd = flb_input(ctx, (char *) "tail", NULL); + ret = flb_input_set(ctx, in_ffd, + "Path", STACKDRIVER_DATA_PATH "/stackdriver_batch_labels_not_a_map.log", + "tag", "test", + "read_from_head", "true", + NULL); + TEST_CHECK_(ret == 0, "setting input options"); + + /* Stackdriver output */ + out_ffd = flb_output(ctx, (char *) "stackdriver", NULL); + ret = flb_output_set(ctx, out_ffd, + "match", "test", + "resource", "gce_instance", + "google_service_credentials", SERVICE_CREDENTIALS, + NULL); + TEST_CHECK_(ret == 0, "setting output options"); + + /* Enable test mode */ + ret = flb_output_set_test(ctx, out_ffd, "formatter", + cb_check_batch_labels_not_a_map, + NULL, NULL); + + /* Start */ + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + sleep(2); + flb_stop(ctx); + flb_destroy(ctx); +} + +void flb_test_batch_mixed_errors() +{ + int ret; + flb_ctx_t *ctx; + int in_ffd; + int out_ffd; + + /* Create context, flush every second (some checks omitted here) */ + ctx = flb_create(); + ret = flb_service_set(ctx, "flush", "1", "grace", "1", NULL); + TEST_CHECK_(ret == 0, "setting service options"); + + /* Tail input mode */ + in_ffd = flb_input(ctx, (char *) "tail", NULL); + ret = flb_input_set(ctx, in_ffd, + "Path", STACKDRIVER_DATA_PATH "/stackdriver_batch_mixed_errors.log", + "tag", "test", + "read_from_head", "true", + NULL); + TEST_CHECK_(ret == 0, "setting input options"); + + /* Stackdriver output */ + out_ffd = flb_output(ctx, (char *) "stackdriver", NULL); + ret = flb_output_set(ctx, out_ffd, + "match", "test", + "resource", "gce_instance", + "google_service_credentials", SERVICE_CREDENTIALS, + NULL); + TEST_CHECK_(ret == 0, "setting output options"); + + /* Enable test mode */ + ret = flb_output_set_test(ctx, out_ffd, "formatter", + cb_check_batch_mixed_errors, + NULL, NULL); + + /* Start */ + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + sleep(2); + flb_stop(ctx); + flb_destroy(ctx); +} + +void flb_test_labels_not_a_map_custom_key() +{ + int ret; + int size = sizeof(LABELS_NOT_A_MAP_CUSTOM_KEY) - 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", "test", NULL); + + /* Stackdriver output with custom labels key */ + out_ffd = flb_output(ctx, (char *) "stackdriver", NULL); + flb_output_set(ctx, out_ffd, + "match", "test", + "resource", "gce_instance", + "labels_key", "logging.googleapis.com/customlabels", + NULL); + + /* Enable test mode */ + ret = flb_output_set_test(ctx, out_ffd, "formatter", + cb_check_labels_not_a_map_custom_key, + NULL, NULL); + + /* Start */ + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + /* Ingest data sample */ + flb_lib_push(ctx, in_ffd, (char *) LABELS_NOT_A_MAP_CUSTOM_KEY, size); + + sleep(2); + flb_stop(ctx); + flb_destroy(ctx); +} + +void flb_test_batch_first_record_labels_not_a_map() +{ + int ret; + flb_ctx_t *ctx; + int in_ffd; + int out_ffd; + + /* Create context, flush every second */ + ctx = flb_create(); + ret = flb_service_set(ctx, "flush", "1", "grace", "1", NULL); + TEST_CHECK_(ret == 0, "setting service options"); + + /* Tail input mode */ + in_ffd = flb_input(ctx, (char *) "tail", NULL); + ret = flb_input_set(ctx, in_ffd, + "Path", STACKDRIVER_DATA_PATH "/stackdriver_batch_first_record_labels_not_a_map.log", + "tag", "test", + "read_from_head", "true", + NULL); + TEST_CHECK_(ret == 0, "setting input options"); + + /* Stackdriver output */ + out_ffd = flb_output(ctx, (char *) "stackdriver", NULL); + ret = flb_output_set(ctx, out_ffd, + "match", "test", + "resource", "gce_instance", + "google_service_credentials", SERVICE_CREDENTIALS, + NULL); + TEST_CHECK_(ret == 0, "setting output options"); + + /* Enable test mode */ + ret = flb_output_set_test(ctx, out_ffd, "formatter", + cb_check_batch_first_record_labels_not_a_map, + NULL, NULL); + + /* Start */ + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + sleep(2); + flb_stop(ctx); + flb_destroy(ctx); +} + +void flb_test_labels_not_a_map_with_extracted_fields() +{ + int ret; + int size = sizeof(LABELS_NOT_A_MAP_WITH_FIELDS) - 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", "test", NULL); + + /* Stackdriver output */ + out_ffd = flb_output(ctx, (char *) "stackdriver", NULL); + flb_output_set(ctx, out_ffd, + "match", "test", + "resource", "gce_instance", + NULL); + + /* Enable test mode */ + ret = flb_output_set_test(ctx, out_ffd, "formatter", + cb_check_labels_not_a_map_with_fields, + NULL, NULL); + + /* Start */ + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + /* Ingest data: invalid labels with httpRequest, operation, etc. */ + flb_lib_push(ctx, in_ffd, (char *) LABELS_NOT_A_MAP_WITH_FIELDS, size); + + sleep(2); + flb_stop(ctx); + flb_destroy(ctx); +} + +void flb_test_batch_all_records_labels_not_a_map() +{ + int ret; + flb_ctx_t *ctx; + int in_ffd; + int out_ffd; + + /* Create context, flush every second */ + ctx = flb_create(); + ret = flb_service_set(ctx, "flush", "1", "grace", "1", NULL); + TEST_CHECK_(ret == 0, "setting service options"); + + /* Tail input mode */ + in_ffd = flb_input(ctx, (char *) "tail", NULL); + ret = flb_input_set(ctx, in_ffd, + "Path", STACKDRIVER_DATA_PATH "/stackdriver_batch_all_labels_not_a_map.log", + "tag", "test", + "read_from_head", "true", + NULL); + TEST_CHECK_(ret == 0, "setting input options"); + + /* Stackdriver output */ + out_ffd = flb_output(ctx, (char *) "stackdriver", NULL); + ret = flb_output_set(ctx, out_ffd, + "match", "test", + "resource", "gce_instance", + "google_service_credentials", SERVICE_CREDENTIALS, + NULL); + TEST_CHECK_(ret == 0, "setting output options"); + + /* Enable test mode */ + ret = flb_output_set_test(ctx, out_ffd, "formatter", + cb_check_batch_all_labels_not_a_map, + NULL, NULL); + + /* Start */ + ret = flb_start(ctx); + TEST_CHECK(ret == 0); + + sleep(2); + flb_stop(ctx); + flb_destroy(ctx); +} + void flb_test_resource_k8s_container_no_local_resource_id() { int ret; @@ -6621,6 +7037,13 @@ TEST_LIST = { {"config_labels_no_conflict", flb_test_config_labels_no_conflict }, {"default_labels_k8s_resource_type", flb_test_default_labels_k8s_resource_type }, {"custom_labels_k8s_resource_type", flb_test_custom_labels_k8s_resource_type }, + {"labels_not_a_map", flb_test_labels_not_a_map }, + {"batch_labels_not_a_map", flb_test_batch_labels_not_a_map }, + {"batch_mixed_errors", flb_test_batch_mixed_errors }, + {"labels_not_a_map_custom_key", flb_test_labels_not_a_map_custom_key }, + {"batch_first_record_labels_not_a_map", flb_test_batch_first_record_labels_not_a_map }, + {"labels_not_a_map_with_extracted_fields", flb_test_labels_not_a_map_with_extracted_fields }, + {"batch_all_records_labels_not_a_map", flb_test_batch_all_records_labels_not_a_map }, /* test resource labels api */ {"resource_labels_one_field", flb_test_resource_labels_one_field },