Skip to content

Commit

Permalink
calyptia: resolve duplicate symbols for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Stephens <[email protected]>
  • Loading branch information
patrick-stephens committed Dec 4, 2024
1 parent b309cf3 commit 89ac5a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 7 additions & 0 deletions plugins/custom_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@

#define UUID_BUFFER_SIZE 38 /* Maximum length of UUID string + null terminator */

/* Function wrappers to enable mocking for unit test filesystem access */
int (*flb_access)(const char *pathname, int mode) = access;
int (*flb_open)(const char *pathname, int flags, ...) = open;
ssize_t (*flb_write)(int fd, const void *buf, size_t count) = write;
int (*flb_close)(int fd) = close;
int (*flb_utils_read_file_wrapper)(char *path, char **out_buf, size_t *out_size) = flb_utils_read_file;

/*
* Check if the key belongs to a sensitive data field, if so report it. We never
* share any sensitive data.
Expand Down
8 changes: 0 additions & 8 deletions plugins/custom_calyptia/calyptia.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#ifndef FLB_CALYPTIA_H
#define FLB_CALYPTIA_H

#include <fluent-bit/flb_utils.h>
#include <stdbool.h>

struct calyptia {
Expand Down Expand Up @@ -65,11 +64,4 @@ 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) = access;
int (*flb_open)(const char *pathname, int flags, ...) = open;
ssize_t (*flb_write)(int fd, const void *buf, size_t count) = write;
int (*flb_close)(int fd) = close;
int (*flb_utils_read_file_wrapper)(char *path, char **out_buf, size_t *out_size) = flb_utils_read_file;

#endif /* FLB_CALYPTIA_H */
2 changes: 2 additions & 0 deletions tests/runtime/custom_calyptia_input_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <fluent-bit/flb_config.h>
#include <fluent-bit/flb_env.h>
#include <fluent-bit/flb_custom_plugin.h>
#include <fluent-bit/flb_mem.h>
#include <fluent-bit/flb_str.h>
#include "flb_tests_runtime.h"
#include "../../plugins/custom_calyptia/calyptia.h"

Expand Down

0 comments on commit 89ac5a9

Please sign in to comment.