Skip to content

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

Merged
millerjp merged 1 commit into
mainfrom
test/bdd-and-fuzz-16
Apr 20, 2026
Merged

test: add godog BDD suite and fuzz targets (#16)#25
millerjp merged 1 commit into
mainfrom
test/bdd-and-fuzz-16

Conversation

@millerjp

Copy link
Copy Markdown

Summary

Closes Phase 4 by landing the BDD contract and fuzz layer. Mirrors axonops/mask's godog scaffolding and adds FuzzLoadStore + FuzzConcurrent for randomised input coverage.

Closes #16.

What's in this PR

File State
tests/bdd/bdd_test.go new — godog entry with Strict: true (mask template verbatim)
tests/bdd/steps/steps.go new — step defs; World carried via context.WithValue; guarded type assertion in worldFrom
tests/bdd/features/syncmap.feature new — 1 Feature, 15 Rules, 37 scenarios covering every public symbol + a concurrent Store scenario
syncmap_fuzz_test.go new — FuzzLoadStore (round-trip) and FuzzConcurrent (4 goroutines, race-clean)
.github/workflows/ci.yml bdd-strict-mode-guard job added (mask verbatim)
go.mod / go.sum github.com/cucumber/godog v0.15.1 + transitives

Scenario coverage

Per Rule: Load ×3, Store ×2, LoadOrStore ×3, LoadAndDelete ×3, Delete ×3, Swap ×3, Clear ×2, Range ×3, Len ×2, Map ×1, Keys ×2, Values ×2, CompareAndSwap ×4, CompareAndDelete ×3, Concurrency ×1 = 37 scenarios.

Local validation

$ make test-bdd
ok github.com/axonops/syncmap/tests/bdd 1.399s  (37 scenarios, 111 steps)

$ go test -fuzz=FuzzLoadStore -fuzztime=1s ./...
… 75,000+ executions, no failures

$ go test -fuzz=FuzzConcurrent -fuzztime=1s ./...
… 22,000+ executions, no failures

$ make check
(14 gates green, coverage 100%, govulncheck clean)

$ actionlint .github/workflows/ci.yml
clean

Agent gates

  • Plan — two-commit or single-commit; went with single commit since CI's bdd-strict-mode-guard job is only useful once the feature file + entry land (no split value).
  • test-writer (pre) — produced the complete suite.
  • code-reviewer (post) — ship it; 8 NITs; applied two (new param rename → from/to; removed unused World.err).
  • security-reviewer (post) — flagged soft BLOCKING on unguarded worldFrom type assertion; fixed with comma-ok + explicit panic message.
  • go-quality — 14/14 PASS.
  • commit-message-reviewer — PASS.

Deferrals

Test plan

  • All 14 CI jobs green (new BDD strict mode guard included)
  • Coverage remains 100% on the main package
  • Fuzz targets continue to pass in the test job (run implicitly via go test when -fuzz is not set — they run as unit tests)

Adds the BDD contract layer and two fuzz targets:

  * tests/bdd/bdd_test.go — godog entry with Strict: true, build
    tag bdd, mirrors axonops/mask verbatim.
  * tests/bdd/steps/steps.go — step defs; per-scenario World
    carried through context.WithValue, fresh instance per
    scenario via sc.Before. Type assertion in worldFrom is
    guarded with a comma-ok panic message per the project's
    no-unguarded-assertions rule.
  * tests/bdd/features/syncmap.feature — one Feature with 15
    Rule blocks and 37 scenarios covering every public symbol
    plus a concurrent Store scenario. No @wip/@skip/@pending
    tags.
  * syncmap_fuzz_test.go — FuzzLoadStore (round-trip invariant)
    and FuzzConcurrent (4 goroutines over the fuzz bytes; race-
    clean, no ordering assertions).
  * .github/workflows/ci.yml — bdd-strict-mode-guard job ported
    verbatim from mask.
  * go.mod/go.sum — github.com/cucumber/godog v0.15.1.

All 37 BDD scenarios pass under -race -tags bdd. Fuzz smoke green
over 1s at 75k+ and 22k+ executions respectively. Coverage remains
at 100%.
@millerjp millerjp merged commit d0ae35a into main Apr 20, 2026
15 checks passed
@millerjp millerjp deleted the test/bdd-and-fuzz-16 branch April 20, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add BDD (godog) suite and fuzz targets

1 participant