Skip to content

chore: move the test fixtures into testenv and expose the contract binaries as an API - #209

Merged
bennyhodl merged 1 commit into
masterfrom
chore/testenv-contract-binaries
Sep 15, 2026
Merged

bennyhodl merged 1 commit into
masterfrom
chore/testenv-contract-binaries

Conversation

@bennyhodl

Copy link
Copy Markdown
Owner

Summary

Fold testconfig/ into the ddk-testenv crate and expose the checked-in contract binaries as an API, so a test names a contract state instead of spelling out a ../../../testconfig/... path. Also deletes the plans/ folder.

Changes

  • Move contract_binaries/, nostr-relay.toml, sample_contract.json, and scripts/ from testconfig/ to testenv/; update docker-compose.yaml, the CI workflow, .gitignore, the generator script, and the docs to match.
  • Add testenv/src/contract_binaries.rs: a ContractBinary enum (OfferedClosed, with ALL and name()), contract_binary(state) and legacy_contract_binary() that return the bytes via include_bytes!, and contract_binaries_dir() for the generator. Not feature-gated; it has no dependencies.
  • Rewrite every include_bytes! and CARGO_MANIFEST_DIR fixture loader in ddk (ser, sled, wallet command, postgres store and row, balance and enumeration tests) to use the new API. The FIXTURES const in ser.rs now iterates ContractBinary::ALL.
  • Remove the five fixtures under old/ that nothing loaded and that stopped deserializing long ago. Keep the one that still matters, an offered contract from before contract_flags, as contract_binaries/legacy/Offered; the three tests that assert it still reads are renamed to say legacy.
  • Drop two blocks of commented-out code in the sled tests that pointed at files that do not exist.
  • Delete plans/custom-tlv-stream.md.

Testing

  • cargo test -p ddk --features sled,postgres --lib for the ser, wallet, sled, and postgres modules: all pass.
  • cargo test -p ddk --tests --no-run: the integration tests compile.
  • cargo test -p ddk-testenv --doc: passes.
  • cargo +nightly fmt --all applied.

…naries as an API

Delete the plans folder and fold testconfig into testenv. The contract
binaries are compiled into ddk-testenv behind a ContractBinary enum, so a
test picks a state instead of spelling out a relative path. The dead
fixtures under old/ are removed; the one that still loads, an offered
contract from before contract_flags, lives at legacy/Offered.
@bennyhodl
bennyhodl merged commit b205a6a into master Sep 15, 2026
138 checks passed
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.

1 participant