diff options
Diffstat (limited to 'exporting/tests')
-rw-r--r-- | exporting/tests/exporting_doubles.c | 2 | ||||
-rw-r--r-- | exporting/tests/exporting_fixtures.c | 2 | ||||
-rw-r--r-- | exporting/tests/test_exporting_engine.c | 24 |
3 files changed, 16 insertions, 12 deletions
diff --git a/exporting/tests/exporting_doubles.c b/exporting/tests/exporting_doubles.c index 3c73e032..b8c9f375 100644 --- a/exporting/tests/exporting_doubles.c +++ b/exporting/tests/exporting_doubles.c @@ -22,6 +22,8 @@ struct engine *__mock_read_exporting_config() instance->config.type = EXPORTING_CONNECTOR_TYPE_GRAPHITE; instance->config.name = strdupz("instance_name"); instance->config.destination = strdupz("localhost"); + instance->config.username = strdupz(""); + instance->config.password = strdupz(""); instance->config.prefix = strdupz("netdata"); instance->config.hostname = strdupz("test-host"); instance->config.update_every = 1; diff --git a/exporting/tests/exporting_fixtures.c b/exporting/tests/exporting_fixtures.c index b5b0ce81..b632761e 100644 --- a/exporting/tests/exporting_fixtures.c +++ b/exporting/tests/exporting_fixtures.c @@ -18,6 +18,8 @@ int teardown_configured_engine(void **state) struct instance *instance = engine->instance_root; free((void *)instance->config.destination); + free((void *)instance->config.username); + free((void *)instance->config.password); free((void *)instance->config.name); free((void *)instance->config.prefix); free((void *)instance->config.hostname); diff --git a/exporting/tests/test_exporting_engine.c b/exporting/tests/test_exporting_engine.c index 73fd3ca6..7188c6ee 100644 --- a/exporting/tests/test_exporting_engine.c +++ b/exporting/tests/test_exporting_engine.c @@ -312,12 +312,12 @@ static void test_exporting_calculate_value_from_stored_data(void **state) expect_function_call(__mock_rrddim_query_is_finished); will_return(__mock_rrddim_query_is_finished, 0); expect_function_call(__mock_rrddim_query_next_metric); - will_return(__mock_rrddim_query_next_metric, pack_storage_number(27, SN_EXISTS)); + will_return(__mock_rrddim_query_next_metric, pack_storage_number(27, SN_DEFAULT_FLAGS)); expect_function_call(__mock_rrddim_query_is_finished); will_return(__mock_rrddim_query_is_finished, 0); expect_function_call(__mock_rrddim_query_next_metric); - will_return(__mock_rrddim_query_next_metric, pack_storage_number(45, SN_EXISTS)); + will_return(__mock_rrddim_query_next_metric, pack_storage_number(45, SN_DEFAULT_FLAGS)); expect_function_call(__mock_rrddim_query_is_finished); will_return(__mock_rrddim_query_is_finished, 1); @@ -431,7 +431,7 @@ static void test_format_dimension_stored_graphite_plaintext(void **state) struct engine *engine = *state; expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); RRDDIM *rd = localhost->rrdset_root->dimensions; assert_int_equal(format_dimension_stored_graphite_plaintext(engine->instance_root, rd), 0); @@ -459,7 +459,7 @@ static void test_format_dimension_stored_json_plaintext(void **state) struct engine *engine = *state; expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); RRDDIM *rd = localhost->rrdset_root->dimensions; assert_int_equal(format_dimension_stored_json_plaintext(engine->instance_root, rd), 0); @@ -487,7 +487,7 @@ static void test_format_dimension_stored_opentsdb_telnet(void **state) struct engine *engine = *state; expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); RRDDIM *rd = localhost->rrdset_root->dimensions; assert_int_equal(format_dimension_stored_opentsdb_telnet(engine->instance_root, rd), 0); @@ -515,7 +515,7 @@ static void test_format_dimension_stored_opentsdb_http(void **state) struct engine *engine = *state; expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); RRDDIM *rd = localhost->rrdset_root->dimensions; assert_int_equal(format_dimension_stored_opentsdb_http(engine->instance_root, rd), 0); @@ -1053,7 +1053,7 @@ static void test_format_host_labels_prometheus(void **state) instance->config.options |= EXPORTING_OPTION_SEND_AUTOMATIC_LABELS; format_host_labels_prometheus(instance, localhost); - assert_string_equal(buffer_tostring(instance->labels), "key1=\"netdata\",key2=\"value2\""); + assert_string_equal(buffer_tostring(instance->labels), "key1=\"value1\",key2=\"value2\""); } static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) @@ -1070,7 +1070,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) will_return(__wrap_now_realtime_sec, 2); expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(localhost, buffer, "test_server", "test_prefix", 0, 0); @@ -1087,7 +1087,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) will_return(__wrap_now_realtime_sec, 2); expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); rrd_stats_api_v1_charts_allmetrics_prometheus_single_host( localhost, buffer, "test_server", "test_prefix", 0, PROMETHEUS_OUTPUT_NAMES | PROMETHEUS_OUTPUT_TYPES); @@ -1106,7 +1106,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) will_return(__wrap_now_realtime_sec, 2); expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(localhost, buffer, "test_server", "test_prefix", 0, 0); @@ -1265,7 +1265,7 @@ static void test_format_dimension_prometheus_remote_write(void **state) RRDDIM *rd = localhost->rrdset_root->dimensions; expect_function_call(__wrap_exporting_calculate_value_from_stored_data); - will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_EXISTS)); + will_return(__wrap_exporting_calculate_value_from_stored_data, pack_storage_number(27, SN_DEFAULT_FLAGS)); expect_function_call(__wrap_add_metric); expect_value(__wrap_add_metric, write_request_p, 0xff); @@ -1877,7 +1877,7 @@ int main(void) cmocka_unit_test_setup_teardown(test_prometheus_label_copy, setup_prometheus, teardown_prometheus), cmocka_unit_test_setup_teardown(test_prometheus_units_copy, setup_prometheus, teardown_prometheus), cmocka_unit_test_setup_teardown( - test_format_host_labels_prometheus, setup_configured_engine, teardown_configured_engine), + test_format_host_labels_prometheus, setup_initialized_engine, teardown_initialized_engine), cmocka_unit_test_setup_teardown( rrd_stats_api_v1_charts_allmetrics_prometheus, setup_prometheus, teardown_prometheus), }; |