diff --git a/plugins/custom_calyptia/calyptia.c b/plugins/custom_calyptia/calyptia.c index f6f81160078..dba68a25f10 100644 --- a/plugins/custom_calyptia/calyptia.c +++ b/plugins/custom_calyptia/calyptia.c @@ -411,7 +411,7 @@ static flb_sds_t generate_base_agent_directory(struct calyptia *ctx, flb_sds_t * return ret; } -static flb_sds_t agent_config_filename(struct calyptia *ctx, char *fname) +flb_sds_t agent_config_filename(struct calyptia *ctx, char *fname) { flb_sds_t cfgname = NULL; flb_sds_t ret; @@ -493,7 +493,7 @@ static int create_agent_directory(struct calyptia *ctx) return 0; } -static flb_sds_t get_machine_id(struct calyptia *ctx) +flb_sds_t get_machine_id(struct calyptia *ctx) { int ret = -1; char *buf = NULL; diff --git a/plugins/custom_calyptia/calyptia.h b/plugins/custom_calyptia/calyptia.h index bffbd6473f6..5da14d80ace 100644 --- a/plugins/custom_calyptia/calyptia.h +++ b/plugins/custom_calyptia/calyptia.h @@ -59,8 +59,8 @@ struct calyptia { }; int set_fleet_input_properties(struct calyptia *ctx, struct flb_input_instance *fleet); -static flb_sds_t agent_config_filename(struct calyptia *ctx, char *fname); -static flb_sds_t get_machine_id(struct calyptia *ctx); +flb_sds_t agent_config_filename(struct calyptia *ctx, char *fname); +flb_sds_t get_machine_id(struct calyptia *ctx); /* These are unique to the agent rather than the fleet */ #define machine_id_fleet_config_filename(a) agent_config_filename((a), "machine-id") diff --git a/tests/runtime/custom_calyptia_input_test.c b/tests/runtime/custom_calyptia_input_test.c index 1eb4a4152f8..427a73fef27 100644 --- a/tests/runtime/custom_calyptia_input_test.c +++ b/tests/runtime/custom_calyptia_input_test.c @@ -18,6 +18,9 @@ struct flb_input_instance *flb_input_new(struct flb_config *config, int public_only); void flb_input_instance_destroy(struct flb_input_instance *ins); +flb_sds_t agent_config_filename(struct calyptia *ctx, char *fname); +flb_sds_t get_machine_id(struct calyptia *ctx); + /* Test context structure */ struct test_context { struct calyptia *ctx; @@ -205,7 +208,7 @@ static void test_calyptia_machine_id_generation() { TEST_CHECK(ret == 0); /* Verify properties were set correctly */ - const char *value; + const char *value, *expectedValue, *machine_id; /* Check config_dir */ value = flb_input_get_property("config_dir", t_ctx->fleet); @@ -219,14 +222,14 @@ static void test_calyptia_machine_id_generation() { * Repeat with custom directory to confirm that works too */ value = machine_id_fleet_config_filename(t_ctx->ctx); - const char* expectedValue = flb_sds_printf(expectedValue, "%s/machine-id.conf", FLEET_DEFAULT_CONFIG_DIR); + expectedValue = flb_sds_printf(expectedValue, "%s/machine-id.conf", FLEET_DEFAULT_CONFIG_DIR); TEST_CHECK(value != NULL); TEST_CHECK(expectedValue != NULL); TEST_MSG("machine_id filename expected=%s got=%s", expectedValue, value); TEST_CHECK(value && strcmp(value, expectedValue) == 0); /* generate a new machine ID and verify it is not null then store for later use */ - const char* machine_id = get_machine_id(t_ctx->ctx); + machine_id = get_machine_id(t_ctx->ctx); TEST_CHECK(machine_id != NULL); /* repeat to confirm existing UUID is maintained */