Fix exporting unit tests (#13816)
Vladimir Kobal committed
Oct 13, 2022 at 18:40 UTC
47cb7811b93db2100766b17b627537525fdbb8e2
3 files changed
+9
-22
exporting/tests/netdata_doubles.c
+1
-2
@@ -198,11 +198,10 @@ time_t __mock_rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle)
198
return mock_type(time_t);
199
}
200
201
-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)
201
+void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time)
202
{
203
(void)db_metric_handle;
204
(void)handle;
205
- (void)tier_query_fetch_type;
205
206
function_called();
207
check_expected(start_time);
exporting/tests/test_exporting_engine.c
+7
-19
@@ -11,6 +11,7 @@ struct config netdata_config;
11
char *netdata_configured_user_config_dir = ".";
12
char *netdata_configured_stock_config_dir = ".";
13
char *netdata_configured_hostname = "test_global_host";
14
+bool global_statistics_enabled = true;
15
16
char log_line[MAX_LOG_LINE + 1];
17
@@ -703,27 +704,14 @@ static void test_simple_connector_worker(void **state)
704
buffer_sprintf(simple_connector_data->last_buffer->header, "test header");
705
buffer_sprintf(simple_connector_data->last_buffer->buffer, "test buffer");
706
706
- expect_function_call(__wrap_connect_to_one_of);
707
- expect_string(__wrap_connect_to_one_of, destination, "localhost");
708
- expect_value(__wrap_connect_to_one_of, default_port, 2003);
709
- expect_not_value(__wrap_connect_to_one_of, reconnects_counter, 0);
710
- expect_string(__wrap_connect_to_one_of, connected_to, "localhost");
711
- expect_value(__wrap_connect_to_one_of, connected_to_size, CONNECTED_TO_MAX);
712
- will_return(__wrap_connect_to_one_of, 2);
707
+ expect_function_call(__wrap_now_realtime_sec);
708
+ will_return(__wrap_now_realtime_sec, 2);
709
714
- expect_function_call(__wrap_send);
715
- expect_value(__wrap_send, sockfd, 2);
716
- expect_not_value(__wrap_send, buf, buffer_tostring(simple_connector_data->last_buffer->buffer));
717
- expect_string(__wrap_send, buf, "test header");
718
- expect_value(__wrap_send, len, 11);
719
- expect_value(__wrap_send, flags, MSG_NOSIGNAL);
710
+ expect_function_call(__wrap_now_realtime_sec);
711
+ will_return(__wrap_now_realtime_sec, 2);
712
721
- expect_function_call(__wrap_send);
722
- expect_value(__wrap_send, sockfd, 2);
723
- expect_value(__wrap_send, buf, buffer_tostring(simple_connector_data->last_buffer->buffer));
724
- expect_string(__wrap_send, buf, "test buffer");
725
- expect_value(__wrap_send, len, 11);
726
- expect_value(__wrap_send, flags, MSG_NOSIGNAL);
713
+ expect_function_call(__wrap_now_realtime_sec);
714
+ will_return(__wrap_now_realtime_sec, 2);
715
716
expect_function_call(__wrap_send_internal_metrics);
717
expect_value(__wrap_send_internal_metrics, instance, instance);
exporting/tests/test_exporting_engine.h
+1
-1
@@ -60,7 +60,7 @@ void __rrdset_check_rdlock(RRDSET *st, const char *file, const char *function, c
60
void __rrd_check_rdlock(const char *file, const char *function, const unsigned long line);
61
time_t __mock_rrddim_query_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle);
62
time_t __mock_rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle);
63
-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);
63
+void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time);
64
int __mock_rrddim_query_is_finished(struct rrddim_query_handle *handle);
65
STORAGE_POINT __mock_rrddim_query_next_metric(struct rrddim_query_handle *handle);
66
void __mock_rrddim_query_finalize(struct rrddim_query_handle *handle);