From 353364ebc9e21b10d5a471a07ce6678fecd1c618 Mon Sep 17 00:00:00 2001 From: Patrick Stephens Date: Wed, 4 Dec 2024 14:49:39 +0000 Subject: [PATCH] calyptia: resolve function pointer usage Signed-off-by: Patrick Stephens --- plugins/custom_calyptia/calyptia.h | 7 +++++++ tests/runtime/custom_calyptia_input_test.c | 1 + 2 files changed, 8 insertions(+) diff --git a/plugins/custom_calyptia/calyptia.h b/plugins/custom_calyptia/calyptia.h index 22937c157ec..534136b6b31 100644 --- a/plugins/custom_calyptia/calyptia.h +++ b/plugins/custom_calyptia/calyptia.h @@ -64,4 +64,11 @@ static flb_sds_t agent_config_filename(struct calyptia *ctx, char *fname); /* These are unique to the agent rather than the fleet */ #define machine_id_fleet_config_filename(a) agent_config_filename((a), "machine-id") +/* Function wrappers to enable mocking for unit test filesystem access */ +int (*flb_access)(const char *pathname, int mode); +int (*flb_open)(const char *pathname, int flags, ...); +ssize_t (*flb_write)(int fd, const void *buf, size_t count); +int (*flb_close)(int fd); +int (*flb_utils_read_file_wrapper)(char *path, char **out_buf, size_t *out_size); + #endif /* FLB_CALYPTIA_H */ diff --git a/tests/runtime/custom_calyptia_input_test.c b/tests/runtime/custom_calyptia_input_test.c index 068189bb042..a09fe1c7c7d 100644 --- a/tests/runtime/custom_calyptia_input_test.c +++ b/tests/runtime/custom_calyptia_input_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "flb_tests_runtime.h" #include "../../plugins/custom_calyptia/calyptia.h"