From 58daab21cd043e1dc37024a7f99b396788372918 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Mar 2024 14:19:48 +0100 Subject: Merging upstream version 1.44.3. Signed-off-by: Daniel Baumann --- fluent-bit/tests/runtime/data/stackdriver/json.h | 12 ++ .../data/stackdriver/stackdriver-credentials.json | 12 ++ .../stackdriver_multi_entries_severity.log | 4 + .../stackdriver/stackdriver_test_http_request.h | 134 +++++++++++++++++++++ .../data/stackdriver/stackdriver_test_insert_id.h | 26 ++++ .../stackdriver/stackdriver_test_k8s_resource.h | 89 ++++++++++++++ .../data/stackdriver/stackdriver_test_labels.h | 44 +++++++ .../data/stackdriver/stackdriver_test_log_name.h | 10 ++ .../stackdriver_test_monitored_resource.h | 46 +++++++ .../data/stackdriver/stackdriver_test_operation.h | 62 ++++++++++ .../stackdriver/stackdriver_test_resource_labels.h | 37 ++++++ .../stackdriver/stackdriver_test_source_location.h | 70 +++++++++++ .../data/stackdriver/stackdriver_test_span_id.h | 6 + .../data/stackdriver/stackdriver_test_timestamp.h | 62 ++++++++++ .../data/stackdriver/stackdriver_test_trace.h | 6 + .../stackdriver/stackdriver_test_trace_sampled.h | 11 ++ 16 files changed, 631 insertions(+) create mode 100755 fluent-bit/tests/runtime/data/stackdriver/json.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver-credentials.json create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_multi_entries_severity.log create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_http_request.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_insert_id.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_k8s_resource.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_labels.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_log_name.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_monitored_resource.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_operation.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_resource_labels.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_source_location.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_span_id.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_timestamp.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace.h create mode 100644 fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace_sampled.h (limited to 'fluent-bit/tests/runtime/data/stackdriver') diff --git a/fluent-bit/tests/runtime/data/stackdriver/json.h b/fluent-bit/tests/runtime/data/stackdriver/json.h new file mode 100755 index 00000000..146dd532 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/json.h @@ -0,0 +1,12 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#define JSON "[" \ + "1448403340," \ + "{" \ + "\"key_0\": false," \ + "\"key_1\": true," \ + "\"key_2\": \"some string\"," \ + "\"key_3\": 0.12345678," \ + "\"key.4\": 5000," \ + "\"END_KEY\": \"JSON_END\"" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver-credentials.json b/fluent-bit/tests/runtime/data/stackdriver/stackdriver-credentials.json new file mode 100644 index 00000000..1ea8afd9 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver-credentials.json @@ -0,0 +1,12 @@ +{ + "type": "service_account", + "project_id": "fluent-bit", + "private_key_id": "837364849384b143e4e21243a2cbcbd26f4fabcdfe", + "private_key": "-----BEGIN PRIVATE KEY-----\nasldjkasdjksa98327498327498327489qajdsijasdjlksajdlksajdlks7+TK\n-----END PRIVATE KEY-----\n", + "client_email": "stackdriver@fluent-bit.iam.gserviceaccount.com", + "client_id": "0123456789", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://accounts.google.com/o/oauth2/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/stackdriver%40fluent-bit.iam.gserviceaccount.com" +} diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_multi_entries_severity.log b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_multi_entries_severity.log new file mode 100644 index 00000000..157cbea6 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_multi_entries_severity.log @@ -0,0 +1,4 @@ +{"message":"test severity1", "severity":"INFO"} +{"message":"test severity2"} +{"message":"test severity3", "severity":"DEBUG"} +{"message":"test severity4"} diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_http_request.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_http_request.h new file mode 100644 index 00000000..2b7ad82d --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_http_request.h @@ -0,0 +1,134 @@ +#define HTTPREQUEST_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"requestMethod\": \"test_requestMethod\"," \ + "\"requestUrl\": \"test_requestUrl\"," \ + "\"userAgent\": \"test_userAgent\"," \ + "\"remoteIp\": \"test_remoteIp\"," \ + "\"serverIp\": \"test_serverIp\"," \ + "\"referer\": \"test_referer\"," \ + "\"latency\": \"0s\"," \ + "\"protocol\": \"test_protocol\"," \ + "\"requestSize\": 123," \ + "\"responseSize\": 123," \ + "\"status\": 200," \ + "\"cacheFillBytes\": 123," \ + "\"cacheLookup\": true," \ + "\"cacheHit\": true," \ + "\"cacheValidatedWithOriginServer\": true" \ + "}" \ + "}]" + +#define EMPTY_HTTPREQUEST "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "}" \ + "}]" + +#define HTTPREQUEST_IN_STRING "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": \"some string\"" \ + "}]" + +#define PARTIAL_HTTPREQUEST "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"cacheLookup\": true," \ + "\"cacheHit\": true," \ + "\"cacheValidatedWithOriginServer\": true" \ + "}" \ + "}]" + +#define HTTPREQUEST_SUBFIELDS_IN_INCORRECT_TYPE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"requestMethod\": 123," \ + "\"requestUrl\": 123," \ + "\"userAgent\": 123," \ + "\"remoteIp\": 123," \ + "\"serverIp\": true," \ + "\"referer\": true," \ + "\"latency\": false," \ + "\"protocol\": false," \ + "\"requestSize\": \"some string\"," \ + "\"responseSize\": true," \ + "\"status\": false," \ + "\"cacheFillBytes\": false," \ + "\"cacheLookup\": \"some string\"," \ + "\"cacheHit\": 123," \ + "\"cacheValidatedWithOriginServer\": 123" \ + "}" \ + "}]" + +#define HTTPREQUEST_EXTRA_SUBFIELDS_EXISTED "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"requestMethod\": \"test_requestMethod\"," \ + "\"requestUrl\": \"test_requestUrl\"," \ + "\"userAgent\": \"test_userAgent\"," \ + "\"remoteIp\": \"test_remoteIp\"," \ + "\"serverIp\": \"test_serverIp\"," \ + "\"referer\": \"test_referer\"," \ + "\"latency\": \"0s\"," \ + "\"protocol\": \"test_protocol\"," \ + "\"requestSize\": 123," \ + "\"responseSize\": 123," \ + "\"status\": 200," \ + "\"cacheFillBytes\": 123," \ + "\"cacheLookup\": true," \ + "\"cacheHit\": true," \ + "\"cacheValidatedWithOriginServer\": true," \ + "\"extra_key1\": \"extra_val1\"," \ + "\"extra_key2\": 123," \ + "\"extra_key3\": true" \ + "}" \ + "}]" + + +/* Tests for 'latency' */ +#define HTTPREQUEST_LATENCY_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"latency\": \" 100.00 s \"" \ + "}" \ + "}]" + +#define HTTPREQUEST_LATENCY_INVALID_SPACES "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"latency\": \" 100. 00 s \"" \ + "}" \ + "}]" + +#define HTTPREQUEST_LATENCY_INVALID_STRING "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"latency\": \" s100.00 s \"" \ + "}" \ + "}]" + +#define HTTPREQUEST_LATENCY_INVALID_END "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/http_request\": " \ + "{" \ + "\"latency\": \" 100.00 \"" \ + "}" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_insert_id.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_insert_id.h new file mode 100644 index 00000000..9cdf3f54 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_insert_id.h @@ -0,0 +1,26 @@ + +#define INSERTID_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/insertId\": \"test_insertId\" " \ + "}]" + +#define EMPTY_INSERTID "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/insertId\": \"\" " \ + "}]" + +#define INSERTID_INCORRECT_TYPE_INT "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/insertId\": 123 " \ + "}]" + +#define INSERTID_INCORRECT_TYPE_MAP "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/insertId\": " \ + "{" \ + "}" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_k8s_resource.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_k8s_resource.h new file mode 100644 index 00000000..9fe1604a --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_k8s_resource.h @@ -0,0 +1,89 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* k8s_container */ +#define K8S_CONTAINER_COMMON "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_CONTAINER_COMMON\"," \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_container.testnamespace.testpod.testctr\"" \ + "}]" + +#define K8S_CONTAINER_COMMON_DIFF_TAGS "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_CONTAINER_COMMON\"," \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_container.diffnamespace.diffpod.diffctr\"" \ + "}]" + +#define K8S_CONTAINER_NO_LOCAL_RESOURCE_ID "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_CONTAINER_COMMON_NO_LOCAL_RESOURCE_ID\"" \ + "}]" + +/* k8s_node */ +#define K8S_NODE_COMMON "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_NODE_COMMON\"," \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_node.testnode\"," \ + "\"PRIORITY\": 6," \ + "\"SYSLOG_FACILITY\": 3," \ + "\"_CAP_EFFECTIVE\": \"3fffffffff\"," \ + "\"_PID\": 1387," \ + "\"_SYSTEMD_UNIT\": \"docker.service\"," \ + "\"END_KEY\": \"JSON_END\"" \ + "}]" + +#define K8S_NODE_NO_LOCAL_RESOURCE_ID "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_NODE_NO_LOCAL_RESOURCE_ID\"," \ + "\"PRIORITY\": 6," \ + "\"SYSLOG_FACILITY\": 3," \ + "\"_CAP_EFFECTIVE\": \"3fffffffff\"," \ + "\"_PID\": 1387," \ + "\"_SYSTEMD_UNIT\": \"docker.service\"," \ + "\"END_KEY\": \"JSON_END\"" \ + "}]" + +#define K8S_NODE_LOCAL_RESOURCE_ID_WITH_DOT "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_NODE_LOCAL_RESOURCE_ID_WITH_DOT\"," \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_node.testnode.withdot.dot\"," \ + "\"PRIORITY\": 6," \ + "\"SYSLOG_FACILITY\": 3," \ + "\"_CAP_EFFECTIVE\": \"3fffffffff\"," \ + "\"_PID\": 1387," \ + "\"_SYSTEMD_UNIT\": \"docker.service\"," \ + "\"END_KEY\": \"JSON_END\"" \ + "}]" + +/* k8s_pod */ +#define K8S_POD_COMMON "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_POD_COMMON\"," \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_pod.testnamespace.testpod\"," \ + "\"key_0\": false," \ + "\"key_1\": true," \ + "\"key_2\": \"some string\"," \ + "\"key_3\": 0.12345678," \ + "\"key_4\": 5000," \ + "\"END_KEY\": \"JSON_END\"" \ + "}]" + +#define K8S_POD_NO_LOCAL_RESOURCE_ID "[" \ + "1591649196," \ + "{" \ + "\"message\": \"K8S_POD_NO_LOCAL_RESOURCE_ID\"," \ + "\"key_0\": false," \ + "\"key_1\": true," \ + "\"key_2\": \"some string\"," \ + "\"key_3\": 0.12345678," \ + "\"key_4\": 5000," \ + "\"END_KEY\": \"JSON_END\"" \ + "}]" + + \ No newline at end of file diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_labels.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_labels.h new file mode 100644 index 00000000..ec3d80b3 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_labels.h @@ -0,0 +1,44 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#define DEFAULT_LABELS "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/labels\": " \ + "{" \ + "\"testA\": \"valA\"," \ + "\"testB\": \"valB\"" \ + "}" \ + "}]" + +#define CUSTOM_LABELS "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/customlabels\": " \ + "{" \ + "\"testA\": \"valA\"," \ + "\"testB\": \"valB\"" \ + "}" \ + "}]" + +#define DEFAULT_LABELS_K8S_RESOURCE_TYPE "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_container.testnamespace.testpod.testctr\"," \ + "\"logging.googleapis.com/labels\": " \ + "{" \ + "\"testA\": \"valA\"," \ + "\"testB\": \"valB\"" \ + "}" \ + "}]" + +#define CUSTOM_LABELS_K8S_RESOURCE_TYPE "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_container.testnamespace.testpod.testctr\"," \ + "\"logging.googleapis.com/customlabels\": " \ + "{" \ + "\"testA\": \"valA\"," \ + "\"testB\": \"valB\"" \ + "}" \ + "}]" + diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_log_name.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_log_name.h new file mode 100644 index 00000000..4d39e242 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_log_name.h @@ -0,0 +1,10 @@ +#define LOG_NAME_OVERRIDE "[" \ + "1591111124," \ + "{" \ + "\"custom_log_name_key\": \"custom_log_name\"" \ + "}]" + +#define LOG_NAME_NO_OVERRIDE "[" \ + "1591111124," \ + "{" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_monitored_resource.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_monitored_resource.h new file mode 100644 index 00000000..d1874928 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_monitored_resource.h @@ -0,0 +1,46 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#define MONITORED_RESOURCE_COMMON_CASE "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/monitored_resource\": " \ + "{" \ + "\"labels\": " \ + "{" \ + "\"project_id\": \"monitored_resource_project_id\"," \ + "\"location\": \"monitored_resource_location\"," \ + "\"testA\": \"valA\"" \ + "}" \ + "}" \ + "}]" + +#define MONITORED_RESOURCE_PRIORITY_HIGHER_THAN_LOCAL_RESOURCE_ID "[" \ + "1591649196," \ + "{" \ + "\"logging.googleapis.com/monitored_resource\": " \ + "{" \ + "\"labels\": " \ + "{" \ + "\"project_id\": \"monitored_resource_project_id\"," \ + "\"location\": \"monitored_resource_location\"," \ + "\"cluster_name\": \"monitored_resource_cluster_name\"," \ + "\"namespace_name\": \"monitored_resource_namespace_name\"," \ + "\"pod_name\": \"monitored_resource_pod_name\"," \ + "\"container_name\": \"monitored_resource_container_name\"" \ + "}" \ + "}," \ + "\"logging.googleapis.com/local_resource_id\": \"k8s_container.testnamespace.testpod.testctr\"" \ + "}]" + +#define MONITORED_RESOURCE_PRIORITY_HIGHER_THAN_GCE_INSTANCE "[" \ + "1448403340," \ + "{" \ + "\"logging.googleapis.com/monitored_resource\": " \ + "{" \ + "\"labels\": " \ + "{" \ + "\"project_id\": \"monitored_resource_project_id\"," \ + "\"zone\": \"monitored_resource_zone\"," \ + "\"instance_id\": \"monitored_resource_instance_id\"" \ + "}" \ + "}" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_operation.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_operation.h new file mode 100644 index 00000000..b3af3722 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_operation.h @@ -0,0 +1,62 @@ +#define OPERATION_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/operation\": " \ + "{" \ + "\"id\": \"test_id\"," \ + "\"producer\": \"test_producer\"," \ + "\"first\": true," \ + "\"last\": true" \ + "}" \ + "}]" + +#define EMPTY_OPERATION "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/operation\": " \ + "{" \ + "}" \ + "}]" + +#define OPERATION_IN_STRING "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/operation\": \"some string\"" \ + "}]" + +#define PARTIAL_SUBFIELDS "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/operation\": " \ + "{" \ + "\"first\": false," \ + "\"last\": false" \ + "}" \ + "}]" + +#define SUBFIELDS_IN_INCORRECT_TYPE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/operation\": " \ + "{" \ + "\"id\": 123," \ + "\"producer\": true," \ + "\"first\": \"some string\"," \ + "\"last\": 123" \ + "}" \ + "}]" + +#define EXTRA_SUBFIELDS_EXISTED "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/operation\": " \ + "{" \ + "\"id\": \"test_id\"," \ + "\"producer\": \"test_producer\"," \ + "\"first\": true," \ + "\"last\": true," \ + "\"extra_key1\": \"extra_val1\"," \ + "\"extra_key2\": 123," \ + "\"extra_key3\": true" \ + "}" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_resource_labels.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_resource_labels.h new file mode 100644 index 00000000..a65a4714 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_resource_labels.h @@ -0,0 +1,37 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#define ONE_FIELD "[" \ + "1591649196," \ + "{" \ + "\"keyA\": \"valA\"" \ + "}]" + +#define MULTIPLE_FIELDS "[" \ + "1591649196," \ + "{" \ + "\"keyA\": \"valA\"," \ + "\"keyB\": \"valB\"" \ + "}]" + +#define NESTED_FIELDS "[" \ + "1591649196," \ + "{" \ + "\"toplevel\": " \ + "{" \ + "\"keyA\": \"valA\"," \ + "\"keyB\": \"valB\"" \ + "}" \ + "}]" + +#define LAYERED_NESTED_FIELDS "[" \ + "1591649196," \ + "{" \ + "\"toplevel\": " \ + "{" \ + "\"midlevel\": " \ + "{" \ + "\"keyA\": \"valA\"" \ + "}," \ + "\"keyB\": \"valB\"" \ + "}" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_source_location.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_source_location.h new file mode 100644 index 00000000..0bf419f5 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_source_location.h @@ -0,0 +1,70 @@ +#define SOURCELOCATION_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/sourceLocation\": " \ + "{" \ + "\"file\": \"test_file\"," \ + "\"line\": 123," \ + "\"function\": \"test_function\"" \ + "}" \ + "}]" + +#define SOURCELOCATION_COMMON_CASE_LINE_IN_STRING "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/sourceLocation\": " \ + "{" \ + "\"file\": \"test_file\"," \ + "\"line\": \"123\"," \ + "\"function\": \"test_function\"" \ + "}" \ + "}]" + +#define EMPTY_SOURCELOCATION "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/sourceLocation\": " \ + "{" \ + "}" \ + "}]" + +#define SOURCELOCATION_IN_STRING "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/sourceLocation\": \"some string\"" \ + "}]" + +#define PARTIAL_SOURCELOCATION "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/sourceLocation\": " \ + "{" \ + "\"function\": \"test_function\"" \ + "}" \ + "}]" + +#define SOURCELOCATION_SUBFIELDS_IN_INCORRECT_TYPE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/sourceLocation\": " \ + "{" \ + "\"file\": 123," \ + "\"line\": \"some string\"," \ + "\"function\": true" \ + "}" \ + "}]" + +#define SOURCELOCATION_EXTRA_SUBFIELDS_EXISTED "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/sourceLocation\": " \ + "{" \ + "\"file\": \"test_file\"," \ + "\"line\": 123," \ + "\"function\": \"test_function\"," \ + "\"extra_key1\": \"extra_val1\"," \ + "\"extra_key2\": 123," \ + "\"extra_key3\": true" \ + "}" \ + "}]" + \ No newline at end of file diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_span_id.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_span_id.h new file mode 100644 index 00000000..5b7b823e --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_span_id.h @@ -0,0 +1,6 @@ +#define SPAN_ID_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/spanId\": \"000000000000004a\"" \ + "}]" + \ No newline at end of file diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_timestamp.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_timestamp.h new file mode 100644 index 00000000..f80cc37d --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_timestamp.h @@ -0,0 +1,62 @@ +/* timestamp after parsing: 2020-07-21T16:40:42.000012345Z */ +#define TIMESTAMP_FORMAT_OBJECT_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"timestamp\": " \ + "{" \ + "\"seconds\": \"1595349642\"," \ + "\"nanos\": \"12345\"" \ + "}" \ + "}]" + +/* "1595349600" in RFC3339 format: 2020-07-21T16:40:00Z */ +#define TIMESTAMP_FORMAT_OBJECT_NOT_A_MAP "[" \ + "1595349600," \ + "{" \ + "\"timestamp\": \"string\"" \ + "}]" + +/* "1595349600" in RFC3339 format: 2020-07-21T16:40:00Z */ +#define TIMESTAMP_FORMAT_OBJECT_MISSING_SUBFIELD "[" \ + "1595349600," \ + "{" \ + "\"timestamp\": " \ + "{" \ + "\"nanos\": \"12345\"" \ + "}" \ + "}]" + +/* "1595349600" in RFC3339 format: 2020-07-21T16:40:00Z */ +#define TIMESTAMP_FORMAT_OBJECT_INCORRECT_TYPE_SUBFIELDS "[" \ + "1595349600," \ + "{" \ + "\"timestamp\": " \ + "{" \ + "\"seconds\": \"string\"," \ + "\"nanos\": true" \ + "}" \ + "}]" + + +/* timestamp after parsing: 2020-07-21T16:40:42.000012345Z */ +#define TIMESTAMP_FORMAT_DUO_FIELDS_COMMON_CASE "[" \ + "1595349600," \ + "{" \ + "\"timestampSeconds\": \"1595349642\"," \ + "\"timestampNanos\": \"12345\"" \ + "}]" + +/* "1595349600" in RFC3339 format: 2020-07-21T16:40:00Z */ +#define TIMESTAMP_FORMAT_DUO_FIELDS_MISSING_NANOS "[" \ + "1595349600," \ + "{" \ + "\"timestampSeconds\": \"1595349642\"" \ + "}]" + +/* "1595349600" in RFC3339 format: 2020-07-21T16:40:00Z */ +#define TIMESTAMP_FORMAT_DUO_FIELDS_INCORRECT_TYPE "[" \ + "1595349600," \ + "{" \ + "\"timestampSeconds\": \"string\"," \ + "\"timestampNanos\": true" \ + "}]" diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace.h new file mode 100644 index 00000000..15c7bc91 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace.h @@ -0,0 +1,6 @@ +#define TRACE_COMMON_CASE "[" \ + "1591111124," \ + "{" \ + "\"trace\": \"test-trace-id-xyz\"" \ + "}]" + \ No newline at end of file diff --git a/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace_sampled.h b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace_sampled.h new file mode 100644 index 00000000..fad628e9 --- /dev/null +++ b/fluent-bit/tests/runtime/data/stackdriver/stackdriver_test_trace_sampled.h @@ -0,0 +1,11 @@ +#define TRACE_SAMPLED_CASE_TRUE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/traceSampled\": true" \ + "}]" + +#define TRACE_SAMPLED_CASE_FALSE "[" \ + "1591111124," \ + "{" \ + "\"logging.googleapis.com/traceSampled\": false" \ + "}]" -- cgit v1.2.3