Skip to content

Commit

Permalink
tests: fix typos
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 5, 2024
1 parent 277eb52 commit b21fc3a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions plugins/custom_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions plugins/custom_calyptia/calyptia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 6 additions & 3 deletions tests/runtime/custom_calyptia_input_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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 */
Expand Down

0 comments on commit b21fc3a

Please sign in to comment.