@cryptotaxi247 / netdata-1 / commits / 352c3941f

Fix unit tests for the exporting engine (#7784)

Vladimir Kobal committed Jan 23, 2020 at 10:34 UTC 352c3941f5f9525a29c705d297461fe73c0640a6
4 files changed +12
CMakeLists.txt
+1
@@ -969,6 +969,7 @@ if(BUILD_TESTING)
969 -Wl,--wrap=notify_workers
970 -Wl,--wrap=send_internal_metrics
971 -Wl,--wrap=now_realtime_sec
972 + -Wl,--wrap=uv_thread_set_name_np
973 -Wl,--wrap=uv_thread_create
974 -Wl,--wrap=uv_mutex_lock
975 -Wl,--wrap=uv_mutex_unlock
Makefile.am
+1
@@ -790,6 +790,7 @@ if ENABLE_UNITTESTS
790 -Wl,--wrap=notify_workers \
791 -Wl,--wrap=send_internal_metrics \
792 -Wl,--wrap=now_realtime_sec \
793 + -Wl,--wrap=uv_thread_set_name_np \
794 -Wl,--wrap=uv_thread_create \
795 -Wl,--wrap=uv_mutex_lock \
796 -Wl,--wrap=uv_mutex_unlock \
exporting/tests/netdata_doubles.c
+8
@@ -17,6 +17,14 @@ time_t __wrap_now_realtime_sec(void)
17 return mock_type(time_t);
18 }
19
20 +void __wrap_uv_thread_set_name_np(uv_thread_t ut, const char* name)
21 +{
22 + (void)ut;
23 + (void)name;
24 +
25 + function_called();
26 +}
27 +
28 void __wrap_info_int(const char *file, const char *function, const unsigned long line, const char *fmt, ...)
29 {
30 (void)file;
exporting/tests/test_exporting_engine.c
+2
@@ -25,6 +25,8 @@ void init_connectors_in_tests(struct engine *engine)
25 expect_value(__wrap_uv_thread_create, worker, simple_connector_worker);
26 expect_value(__wrap_uv_thread_create, arg, engine->connector_root->instance_root);
27
28 + expect_function_call(__wrap_uv_thread_set_name_np);
29 +
30 assert_int_equal(__real_init_connectors(engine), 0);
31
32 assert_int_equal(engine->now, 2);