Skip to content

test(bdr): unit-test the Big Dumb Reply cache accessors #391

Closed

Description

@gg582

Background

The Big Dumb Reply cache (`include/cwist/sys/app/big_dumb_reply.h`) auto-caches high-latency endpoint responses, but its public accessors have no wired unit test and sit in `scripts/ci/api-untested-baseline.txt`:

  • `cwist_bdr_put_fixed` — cache a fixed static response up front
  • `cwist_bdr_get` — look up a cached response by method + path
  • `cwist_bdr_get_pinned` / `cwist_bdr_unpin` — epoch-pinned lookup
  • `cwist_bdr_set_limits` — cap cache bytes / entry age / revalidate hits

What to do

  1. Create `tests/test_bdr_cache.c` using `cwist_bdr_create()` (no app/server needed — the cache is standalone).
  2. Suggested cases:
    • `put_fixed` then `get` returns the same bytes and length; `get` on an unregistered path returns NULL.
    • `get_pinned` returns the blob plus a pin; the blob stays readable until `cwist_bdr_unpin`.
    • `set_limits` with small `max_bytes` evicts (or refuses) an oversized `put_fixed` — assert the documented behavior from the header comments.
    • Cache key is per-method: the same path registered for GET is not returned for POST.
  3. Add a Makefile target (build + run, mirroring `test_app_named_routes_and_error_handler`) and add it to the test list.
  4. Remove the covered names from `scripts/ci/api-untested-baseline.txt`.

Acceptance criteria

  • `make test_bdr_cache` (or your target name) passes.
  • `python3 scripts/ci/check_api_test_coverage.py` exits 0 with a higher tested count.

Pointers

Activity

  1. AnushreeKasturi commented on Oct 17, 2026

    @AnushreeKasturi
    Contributor

    Hi, I'd like to work on this one. I'll add the unit tests for the BDR cache accessors and open a PR.

  2. gg582 commented on Oct 17, 2026

    @gg582
    MemberAuthor

    I appreciate it. 😃😃

  3. gg582 commented on Oct 17, 2026

    @gg582
    MemberAuthor

    Also, we have Discord here. Feel free to join Discord 😄 Also, I'd like to get more stars

  4. Bhumika-1432006 commented on Oct 17, 2026

    @Bhumika-1432006
    Contributor

    Picking this up.

  5. added a commit that references this issue on Oct 18, 2026
    7d1df8e
  6. gg582 commented on Oct 20, 2026

    @gg582
    MemberAuthor

    @AnushreeKasturi Hi, can you work on #203 this problem?

    It's delayed for a month.

  7. AnushreeKasturi commented on Oct 20, 2026

    @AnushreeKasturi
    Contributor

    Opened PR #425 (#425) with a status update for #203. JSPI is still flagged in Node, so stage 3 stays open until it's unflagged.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions