The bug comes with the SQLx-sqlite pool bug, where several connections are
created by default, but the `new` function takes care of that, fixing that bug
by making a single instance of the database.
If constructed directly, the pool would create several connections to the
database, which in most instances is fine, but with SQLite :memory: each
connection is entirely independent.
Also follow documentation to make sure that failed `acquire` will not end up
dropping connections by setting test_before_acquire to false
However, if your workload is sensitive to dropped connections such as using an in-memory
SQLite database with a pool size of 1, you can pretty easily ensure that a cancelled
`acquire()` call will never drop connections by tweaking your [`PoolOptions`]:
* Set [`test_before_acquire(false)`][PoolOptions::test_before_acquire]
* Never set [`before_acquire`][PoolOptions::before_acquire] or
[`after_connect`][PoolOptions::after_connect].
* chore: Add nutshell wallet integration test script
feat: Add MINT_URL configuration for docker container in nutshell wallet integration test script
chore: Make nutshell_wallet_itest.sh executable
fix: Update MINT_URL to use host.docker.internal for Docker container access
feat: Add Docker container startup for Cashu daemon in wallet integration test script
chore: Update Docker image to use Docker Hub repository
feat: Add cleanup trap to stop Docker container and unset variables
feat: Add initial test stub for nutshell wallet mint functionality
test: Add Cashu wallet mint integration test
feat: Add just command for nutshell wallet integration test
refactor: Organize imports and improve code formatting in nutshell wallet test
fix: Update Cashu Docker image and test URL for correct container access
fix: Update Docker container name and image for Cashu wallet test script
fix: Handle Docker container name conflict in nutshell wallet integration test
fix: Update Docker image to cashubtc/nutshell:latest in wallet integration test script
feat: Add support for running separate Nutshell mint and wallet containers
feat: Update Nutshell mint and wallet container configurations for integration testing
fix: Update wallet port and container configuration in integration test script
chore: Export MINT_URL and WALLET_URL as environment variables
fix: Update invoice creation and state checking in nutshell wallet test
fix: Update MINT_URL to use host.docker.internal for container access
fix: Update nutshell wallet mint test to handle invoice payment state
refactor: Improve Nutshell wallet test with better error handling and robustness
refactor: Improve code formatting and logging in nutshell wallet test
refactor: Replace anyhow with expect for error handling in Nutshell wallet test
refactor: Simplify error handling in Nutshell wallet mint test
refactor: Replace `?` with `expect()` in Nutshell wallet test
refactor: Simplify nutshell wallet test by removing unused code and improving error handling
refactor: Extract minting and balance helper functions in nutshell wallet test
feat: Add test for Nutshell wallet token swap functionality
fix: Trim quotes from token in nutshell wallet swap test
refactor: Remove debug print statements and improve code readability
refactor: Improve test_nutshell_wallet_melt with payment state checking and balance verification
refactor: Update Nutshell wallet integration test script configuration
feat: Extract common mint startup function into shared script
refactor: Simplify nutshell wallet integration test script and improve startup process
feat: Add mintd process termination and test status capture in integration test script
refactor: Capitalize env vars and ensure comprehensive cleanup in trap
feat: nutshell wallet test
* ci: Add test step for Nutshell wallet integration tests
* ci: Split Nutshell integration tests into separate jobs
* feat: nutshell wallet test
* ci: Add Docker setup and increase timeout for Nutshell wallet integration tests
* chore: Improve Nutshell wallet integration test script robustness
* fix: Remove -i flag from Nix develop and improve Docker accessibility check
* fix: payment processor
* fix: wallet tests
* feat: Add integration shell with Docker and Rust stable for testing
* ci: Simplify Nutshell wallet integration test workflow and script
* fix: Improve mintd endpoint detection and error handling in integration test script
* fix: wallet tests
* Here's a commit message for this change:
refactor: Move mint tests to fake_wallet.rs and add descriptive comments
refactor: pure wallet/mint does not need arc
refactor: Consolidate NUT-06 test into single function and remove redundant module
docs: Add comments explaining test purposes in integration tests file
refactor: Remove anyhow and replace with expect for error handling
refactor: use expect in pure tests
feat: Add configurable database type via environment variable for test mint and wallet
refactor: Update database initialization in test mint and wallet creation
feat: Add temporary directory support for redb and sqlite databases in tests
feat: Add database type argument to test commands in justfile
ci: Add build matrix for pure-itest with memory, sqlite, and redb databases
refactor: use expect in pure tests
refactor: Move and refactor `test_swap_unbalanced` from mint to integration tests pure
refactor: move mint tests to pure tests
docs: Add detailed comments explaining test file purposes for mint and integration tests
refactor: Extract keyset ID retrieval into a reusable function
test: Add concurrent double-spend test with 3 swap transactions
refactor: Simplify concurrent swap request processing and error handling
test: Add check to verify all proofs are marked as spent in concurrent double-spend test
refactor: Optimize proof state retrieval in concurrent double-spend test
feat: Add test for concurrent melt race condition with same proofs
fix: Update concurrent melt test to use melt quote and handle errors
refactor: melt concurrrent
refactor: Rename test function for clarity in concurrent double-spend scenario
refactor: Modify test_concurrent_double_spend_melt to manually create melt requests in mint tasks
feat: con melt test
refactor: Optimize proof state handling and error recovery in check_spendable
refactor: Extract helper method to reset proofs to original state
fix: reset y states
fix: reset y states
* fix: acces of priv feilds
* fix: add extra migrate
- MintKeysDatabase
- MintQuotesDatabase
- MintProofsDatabase
- MintSignaturesDatabase
This commit splits the MintDatabase trait with 30+ methods into a series
of smaller traits, each dedicate to a specific subsystem of the mint
service.
* Drop the in-memory database
Fixes#607
This PR drops the implementation of in-memory database traits.
They are useful for testing purposes since the tests should test our codebase
and assume the database works as expected (although a follow-up PR should write
a sanity test suite for all database trait implementors).
As complexity is worth with database requirements to simplify complexity and
add more robustness, for instance, with the following plans to add support for
transactions or buffered writes, it would become more complex and
time-consuming to support a correct database trait. This PR drops the
implementation and replaces it with a SQLite memory instance
* Remove OnceCell<Mint>
Without this change, a single Mint is shared for all tests, and the first tests
to run and shutdown makes the other databases (not-reachable, as dropping the
tokio engine would also drop the database instance).
There is no real reason, other than perhaps performance. The mint should
perhaps run in their own tokio engine and share channels as API interfaces, or
a new instance should be created in each tests
* Fixed bug with foreign keys
[1] https://gist.github.com/crodas/bad00997c63bd5ac58db3c5bd90747ed
* Show more debug on failure
* Remove old code
* Remove old references to WalletMemoryDatabase
* refactor: consolidate validation checks
* refactor: melt verification checks
* refactor: mint verification
* chore: clippy
* chore: use error codes
* fix: order of verifications
* fix: p2pk test ws updates
We only expect the proof to be set to pending once. As a proof without
a signature failes before the spent check where the state is chaged.
* fix: mint_melt regtest frome wait