Skip to content

test: add BDD (godog) suite and fuzz targets #16

@millerjp

Description

@millerjp

test: add BDD (godog) suite and fuzz targets

Summary

Add a Godog BDD suite covering every public method and every concurrency scenario the library guarantees, plus go test -fuzz targets for Load/Store round-trips and random concurrent operations. Re-enables the bdd-strict-mode-guard CI job that was deferred in #8.

Requirements

  1. tests/bdd/ tree:
    • tests/bdd/features/syncmap.feature — Gherkin scenarios covering: Load (present / missing / zero V), Store (new / overwrite), LoadOrStore (absent / present / contention), LoadAndDelete (present / missing / zero V), Delete (present / missing / idempotent), Range (all / early return / concurrent writes), Len (after store / after delete), Map (snapshot independence), Keys (match / empty), Values (match / empty), Swap (absent / present / concurrent), Clear (empty / populated), CompareAndSwap (match / mismatch / missing / contention), CompareAndDelete (match / mismatch / missing).
    • tests/bdd/steps/syncmap_steps.go — step definitions; thin wrappers that translate Gherkin to SyncMap calls.
    • tests/bdd/suite_test.go — godog TestSuite{} entry with Strict: true explicitly set (satisfies bdd-strict-mode-guard).
    • All files carry Apache 2.0 header; build tag //go:build bdd.
  2. Fuzz targets in a new syncmap_fuzz_test.go (package syncmap_test, Apache header):
    • FuzzLoadStore — random byte keys + values, verify Load returns what was Stored.
    • FuzzConcurrent — random interleaved Store/Delete/Load operations across multiple goroutines; asserts no panic under -race.
  3. makefile-targets-guard stays satisfied; make test-bdd is already in place.
  4. CI: re-enable bdd-strict-mode-guard job in ci.yml (ported verbatim from mask, now that tests/bdd/ exists).
  5. No @wip / @skip / @pending / @todo tags anywhere in feature files (enforced by bdd-strict-mode-guard).
  6. godog and goleak dependencies added to go.mod if not already present. Both are test-only.

Acceptance Criteria

  1. tests/bdd/features/syncmap.feature exists with ≥1 Scenario per public symbol.
  2. tests/bdd/steps/syncmap_steps.go exists and registers step definitions for every phrase used in the feature file.
  3. tests/bdd/suite_test.go contains exactly one godog.TestSuite{…} construction with Strict: true on a line by itself (grep-able).
  4. make test-bdd exits 0, runs every scenario, reports zero failures and zero undefined/pending/skipped steps.
  5. go test -fuzz=FuzzLoadStore -fuzztime=30s ./... runs without panics.
  6. go test -fuzz=FuzzConcurrent -fuzztime=30s ./... runs without panics under -race.
  7. bdd-strict-mode-guard job in ci.yml is enabled and passes on this PR.
  8. make check passes; CI on the PR green.
  9. Every new .go file carries the Apache 2.0 header.
  10. No AI-attribution tokens in any new file.

Testing Requirements

  • make test-bdd green.
  • go test -fuzz short runs (CI runs with explicit -fuzztime) green.
  • CI bdd-strict-mode-guard green.
  • make check green.

Documentation Requirements

Dependencies

Labels

  • testing
  • P1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Important, not blockingtestingTests: unit, BDD, benchmarks, fuzz

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions