summaryrefslogtreecommitdiffstats
path: root/exporting/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:42 +0000
commit112b5b91647c3dea45cc1c9bc364df526c8012f1 (patch)
tree450af925135ec664c4310a1eb28b69481094ee2a /exporting/tests
parentReleasing debian version 1.32.1-2. (diff)
downloadnetdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.tar.xz
netdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.zip
Merging upstream version 1.33.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'exporting/tests')
-rw-r--r--exporting/tests/test_exporting_engine.c78
1 files changed, 58 insertions, 20 deletions
diff --git a/exporting/tests/test_exporting_engine.c b/exporting/tests/test_exporting_engine.c
index 7188c6eee..fb08ff43b 100644
--- a/exporting/tests/test_exporting_engine.c
+++ b/exporting/tests/test_exporting_engine.c
@@ -1309,27 +1309,65 @@ static void test_format_batch_prometheus_remote_write(void **state)
assert_int_equal(format_batch_prometheus_remote_write(instance), 0);
BUFFER *buffer = instance->buffer;
- assert_int_equal(buffer_strlen(buffer), 192);
-
- BUFFER *escaped_buffer = buffer_create(850);
- size_t len = buffer_strlen(buffer);
- char *ch = (char *)buffer_tostring(buffer);
- for (; len > 0; ch++, len--)
- buffer_sprintf(escaped_buffer, "\\%03o", (unsigned int)*ch);
+ char *write_request_string = calloc(1, 1000);
+ convert_write_request_to_string(buffer_tostring(buffer), buffer_strlen(buffer), write_request_string, 999);
+ assert_int_equal(strlen(write_request_string), 753);
assert_string_equal(
- buffer_tostring(escaped_buffer),
- "\\37777777641\\002\\120\\012\\37777777622\\001\\012\\025\\012\\010\\137\\137\\156\\141\\155\\145\\137\\137"
- "\\022\\011\\164\\145\\163\\164\\005\\015\\064\\012\\031\\012\\010\\151\\156\\163\\164\\141\\156\\143\\145\\022"
- "\\015\\005\\027\\021\\017\\100\\012\\037\\012\\013\\141\\160\\160\\154\\151\\143\\141\\164\\151\\157\\156\\022"
- "\\020\\005\\036\\035\\022\\034\\012\\027\\012\\007\\166\\145\\162\\163\\001\\035\\000\\014\\005\\035\\015\\016"
- "\\014\\012\\026\\012\\010\\005\\020\\020\\153\\145\\171\\022\\012\\005\\012\\040\\166\\141\\154\\165\\145\\022"
- "\\014\\011\\000\\005\\001\\030\\37777777760\\077\\020\\37777777713\\165\\012\\37777777611\\142\\37777777625"
- "\\000\\034\\023\\012\\005\\143\\150\\141\\162\\164\\011\\075\\000\\040\\005\\014\\054\\012\\025\\012\\006\\146"
- "\\141\\155\\151\\154\\171\\022\\013\\005\\123\\011\\015\\040\\012\\033\\012\\011\\144\\151\\155\\145\\156\\005"
- "\\37777777607\\000\\016\\005\\032\\025\\020\\000\\012\\146\\37777777736\\000\\064\\022\\014\\011\\000\\000\\000"
- "\\004\\130\\123\\37777777635\\101\\020\\37777777714\\165");
-
- buffer_free(escaped_buffer);
+ write_request_string,
+ "timeseries {\n"
+ " labels {\n"
+ " name: \"__name__\"\n"
+ " value: \"test_name\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"instance\"\n"
+ " value: \"test_instance\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"application\"\n"
+ " value: \"test_application\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"version\"\n"
+ " value: \"test_version\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"test_key\"\n"
+ " value: \"test_value\"\n"
+ " }\n"
+ " samples {\n"
+ " value: 1\n"
+ " timestamp: 15051\n"
+ " }\n"
+ "}\n"
+ "timeseries {\n"
+ " labels {\n"
+ " name: \"__name__\"\n"
+ " value: \"test_name\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"chart\"\n"
+ " value: \"test chart\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"family\"\n"
+ " value: \"test_family\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"dimension\"\n"
+ " value: \"test_dimension\"\n"
+ " }\n"
+ " labels {\n"
+ " name: \"instance\"\n"
+ " value: \"test_instance\"\n"
+ " }\n"
+ " samples {\n"
+ " value: 123000321\n"
+ " timestamp: 15052\n"
+ " }\n"
+ "}\n");
+ free(write_request_string);
+
protocol_buffers_shutdown();
}
#endif // ENABLE_PROMETHEUS_REMOTE_WRITE