chore: move the test fixtures into testenv and expose the contract binaries as an API - #209
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fold
testconfig/into theddk-testenvcrate 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 theplans/folder.Changes
contract_binaries/,nostr-relay.toml,sample_contract.json, andscripts/fromtestconfig/totestenv/; updatedocker-compose.yaml, the CI workflow,.gitignore, the generator script, and the docs to match.testenv/src/contract_binaries.rs: aContractBinaryenum (Offered…Closed, withALLandname()),contract_binary(state)andlegacy_contract_binary()that return the bytes viainclude_bytes!, andcontract_binaries_dir()for the generator. Not feature-gated; it has no dependencies.include_bytes!andCARGO_MANIFEST_DIRfixture loader inddk(ser, sled, wallet command, postgres store and row,balanceandenumerationtests) to use the new API. TheFIXTURESconst inser.rsnow iteratesContractBinary::ALL.old/that nothing loaded and that stopped deserializing long ago. Keep the one that still matters, an offered contract from beforecontract_flags, ascontract_binaries/legacy/Offered; the three tests that assert it still reads are renamed to saylegacy.plans/custom-tlv-stream.md.Testing
cargo test -p ddk --features sled,postgres --libfor 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 --allapplied.