diff options
author | Vladimir Kobal <vlad@prokk.net> | 2022-10-13 18:40:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-13 18:40:53 +0300 |
commit | 47cb7811b93db2100766b17b627537525fdbb8e2 (patch) | |
tree | e55f6fdfb769922f6cdbb08ad75e0adad722049b /exporting/tests | |
parent | c6f563da745f7d5d97b9408700fd87d484835e55 (diff) |
Fix exporting unit tests (#13816)
Diffstat (limited to 'exporting/tests')
-rw-r--r-- | exporting/tests/netdata_doubles.c | 3 | ||||
-rw-r--r-- | exporting/tests/test_exporting_engine.c | 26 | ||||
-rw-r--r-- | exporting/tests/test_exporting_engine.h | 2 |
3 files changed, 9 insertions, 22 deletions
diff --git a/exporting/tests/netdata_doubles.c b/exporting/tests/netdata_doubles.c index abc6f77bba..7e5017a5fc 100644 --- a/exporting/tests/netdata_doubles.c +++ b/exporting/tests/netdata_doubles.c @@ -198,11 +198,10 @@ time_t __mock_rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle) return mock_type(time_t); } -void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type) +void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time) { (void)db_metric_handle; (void)handle; - (void)tier_query_fetch_type; function_called(); check_expected(start_time); diff --git a/exporting/tests/test_exporting_engine.c b/exporting/tests/test_exporting_engine.c index cabd0a2f7d..6ea6b1e5cc 100644 --- a/exporting/tests/test_exporting_engine.c +++ b/exporting/tests/test_exporting_engine.c @@ -11,6 +11,7 @@ struct config netdata_config; char *netdata_configured_user_config_dir = "."; char *netdata_configured_stock_config_dir = "."; char *netdata_configured_hostname = "test_global_host"; +bool global_statistics_enabled = true; char log_line[MAX_LOG_LINE + 1]; @@ -703,27 +704,14 @@ static void test_simple_connector_worker(void **state) buffer_sprintf(simple_connector_data->last_buffer->header, "test header"); buffer_sprintf(simple_connector_data->last_buffer->buffer, "test buffer"); - expect_function_call(__wrap_connect_to_one_of); - expect_string(__wrap_connect_to_one_of, destination, "localhost"); - expect_value(__wrap_connect_to_one_of, default_port, 2003); - expect_not_value(__wrap_connect_to_one_of, reconnects_counter, 0); - expect_string(__wrap_connect_to_one_of, connected_to, "localhost"); - expect_value(__wrap_connect_to_one_of, connected_to_size, CONNECTED_TO_MAX); - will_return(__wrap_connect_to_one_of, 2); + expect_function_call(__wrap_now_realtime_sec); + will_return(__wrap_now_realtime_sec, 2); - expect_function_call(__wrap_send); - expect_value(__wrap_send, sockfd, 2); - expect_not_value(__wrap_send, buf, buffer_tostring(simple_connector_data->last_buffer->buffer)); - expect_string(__wrap_send, buf, "test header"); - expect_value(__wrap_send, len, 11); - expect_value(__wrap_send, flags, MSG_NOSIGNAL); + expect_function_call(__wrap_now_realtime_sec); + will_return(__wrap_now_realtime_sec, 2); - expect_function_call(__wrap_send); - expect_value(__wrap_send, sockfd, 2); - expect_value(__wrap_send, buf, buffer_tostring(simple_connector_data->last_buffer->buffer)); - expect_string(__wrap_send, buf, "test buffer"); - expect_value(__wrap_send, len, 11); - expect_value(__wrap_send, flags, MSG_NOSIGNAL); + expect_function_call(__wrap_now_realtime_sec); + will_return(__wrap_now_realtime_sec, 2); expect_function_call(__wrap_send_internal_metrics); expect_value(__wrap_send_internal_metrics, instance, instance); diff --git a/exporting/tests/test_exporting_engine.h b/exporting/tests/test_exporting_engine.h index 5443c6018d..a9180a5185 100644 --- a/exporting/tests/test_exporting_engine.h +++ b/exporting/tests/test_exporting_engine.h @@ -60,7 +60,7 @@ void __rrdset_check_rdlock(RRDSET *st, const char *file, const char *function, c void __rrd_check_rdlock(const char *file, const char *function, const unsigned long line); time_t __mock_rrddim_query_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle); time_t __mock_rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle); -void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type); +void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time); int __mock_rrddim_query_is_finished(struct rrddim_query_handle *handle); STORAGE_POINT __mock_rrddim_query_next_metric(struct rrddim_query_handle *handle); void __mock_rrddim_query_finalize(struct rrddim_query_handle *handle); |