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

Simplify the end-to-end tests harness #170

Merged
merged 2 commits into from
Nov 13, 2024

Commits on Nov 13, 2024

  1. tests: harness: autoconfigure hook opts in test chains

    Remove bf_chain_get() and replace it with bf_test_chain_get() which
    doesn't allow custom hook options. bf_test_chain_get() will
    automatically configure the hook options so the generate BPF program is
    not attached and has a name prefixed with `bf_e2e_`.
    
    Because bf_test_chain_get() generates a program name suffixed with
    random characters, rand() is used. 2 clang-tidy checks have been
    disabled as rand() is not cryptographically secure, but it's fine for
    this use case.
    qdeslandes committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    2ef953c View commit details
    Browse the repository at this point in the history
  2. tests: harness: generate the BPF program from bf_test_prog_get()

    bf_test_prog_get() is used to get a reference to a BPF program loaded
    into the kernel. The user must call bf_cli_set_chain() beforehand for
    bf_test_prog_get() to succeed.
    
    However, end-to-end tests will always perform the same step:
    - Call bf_cli_set_chain() to generate and load the BPF program
    - Call bf_test_prog_get() to get a reference to the generated program
    
    Modify bf_test_prog_get() to take a chain as parameter and send it to
    the daemon, then, returns a reference to the program as a result. This
    change reduces the boilerplate required to perform the actual test, and
    ensure the user only have access to relevant high-level concepts.
    qdeslandes committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    ae8cf94 View commit details
    Browse the repository at this point in the history