Repository navigation
test: add BDD (godog) suite and fuzz targets #16
Copy link
Copy link
Closed
Labels
P1Important, not blockingImportant, not blockingtestingTests: unit, BDD, benchmarks, fuzzTests: unit, BDD, benchmarks, fuzz
Description
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
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— godogTestSuite{}entry withStrict: trueexplicitly set (satisfiesbdd-strict-mode-guard).- All files carry Apache 2.0 header; build tag
//go:build bdd.
- Fuzz targets in a new
syncmap_fuzz_test.go(package syncmap_test, Apache header):FuzzLoadStore— random byte keys + values, verifyLoadreturns what wasStored.FuzzConcurrent— random interleaved Store/Delete/Load operations across multiple goroutines; asserts no panic under-race.
makefile-targets-guardstays satisfied;make test-bddis already in place.- CI: re-enable
bdd-strict-mode-guardjob inci.yml(ported verbatim from mask, now thattests/bdd/exists). - No
@wip/@skip/@pending/@todotags anywhere in feature files (enforced bybdd-strict-mode-guard). godogandgoleakdependencies added togo.modif not already present. Both are test-only.
Acceptance Criteria
tests/bdd/features/syncmap.featureexists with ≥1 Scenario per public symbol.tests/bdd/steps/syncmap_steps.goexists and registers step definitions for every phrase used in the feature file.tests/bdd/suite_test.gocontains exactly onegodog.TestSuite{…}construction withStrict: trueon a line by itself (grep-able).make test-bddexits 0, runs every scenario, reports zero failures and zero undefined/pending/skipped steps.go test -fuzz=FuzzLoadStore -fuzztime=30s ./...runs without panics.go test -fuzz=FuzzConcurrent -fuzztime=30s ./...runs without panics under-race.bdd-strict-mode-guardjob inci.ymlis enabled and passes on this PR.make checkpasses; CI on the PR green.- Every new
.gofile carries the Apache 2.0 header. - No AI-attribution tokens in any new file.
Testing Requirements
make test-bddgreen.go test -fuzzshort runs (CI runs with explicit-fuzztime) green.- CI
bdd-strict-mode-guardgreen. make checkgreen.
Documentation Requirements
- BDD features serve as behavioural documentation — they replace the "what does the library do?" prose narrative.
- README reference to the BDD location is added in feat: add top-level CompareAndSwap and CompareAndDelete functions #14.
Dependencies
- Blocked by: test: rewrite unit tests to external package with testify/goleak; coverage ≥95% #10 (tests scaffolding), chore: align CI, release, and tooling to axonops/mask pattern (#8) #9 (Swap/Clear methods must exist to be BDD-tested), test: rewrite unit tests to external package with testify/goleak; coverage ≥95% #10-CAS (same reason).
- Blocks: release v1.0.0 (BDD is "the contract" per CLAUDE.md).
Labels
testingP1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1Important, not blockingImportant, not blockingtestingTests: unit, BDD, benchmarks, fuzzTests: unit, BDD, benchmarks, fuzz
Activity
test: add godog BDD suite and fuzz targets (#16)