Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: internal: log_event_encoder: add test case for issue 8137 #8373

Closed

Conversation

nokute78
Copy link
Collaborator

This patch is to add test for following function of filter_nest.

static void helper_pack_string_add_prefix(struct flb_log_event_encoder *log_encoder,
        struct filter_nest_ctx *ctx,
        const char *str,
        int len)
{
    flb_log_event_encoder_append_body_values(
        log_encoder,
        FLB_LOG_EVENT_STRING_LENGTH_VALUE(ctx->prefix_len + len),
        FLB_LOG_EVENT_STRING_BODY_VALUE(ctx->prefix, ctx->prefix_len),
        FLB_LOG_EVENT_STRING_BODY_VALUE(str, len));
}

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [N/A] Backport to latest stable release.

Debug/Valgrind output

$ valgrind --leak-check=full bin/flb-it-log_event_encoder 
==59464== Memcheck, a memory error detector
==59464== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==59464== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==59464== Command: bin/flb-it-log_event_encoder
==59464== 
Test basic_format_fluent_bit_v2...              [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test basic_format_fluent_bit_v1...              [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test basic_metadata_format_fluent_bit_v2...     [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test create_destroy...                          [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test create_unsupported_format...               [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test init_destroy...                            [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test init_unsupported_format...                 [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test emit_raw_record...                         [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
Test issue_8137...                              [ OK ]
==59464== Warning: invalid file descriptor -1 in syscall close()
SUCCESS: All unit tests have passed.
==59464== 
==59464== HEAP SUMMARY:
==59464==     in use at exit: 0 bytes in 0 blocks
==59464==   total heap usage: 7,655 allocs, 7,655 frees, 1,000,142 bytes allocated
==59464== 
==59464== All heap blocks were freed -- no leaks are possible
==59464== 
==59464== For lists of detected and suppressed errors, rerun with: -s
==59464== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@nokute78
Copy link
Collaborator Author

This test code can't detect issue 8137.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant