Skip to content

Export InMemoryTestPersister under _test-utils#761

Merged
arminsabouri merged 1 commit intopayjoin:masterfrom
arminsabouri:move-inmem-session-persister
Jun 11, 2025
Merged

Export InMemoryTestPersister under _test-utils#761
arminsabouri merged 1 commit intopayjoin:masterfrom
arminsabouri:move-inmem-session-persister

Conversation

@arminsabouri
Copy link
Collaborator

InMemoryTestPerister now becomes generic over what events it is storing in memory allowing for other rust-payjoin mods to test storing and replaying session logs. We expose the in-memory session persister under a new feature flag: _test-utils.

We also re-export the in-memory session persister through the payjoin-test-utils crate and added a crates-io patch making it available to other workspace members that use payjoin-test-utils at version 0.0.0. This exposes the in-memory session persister to the int. and FFI test suites.

Co-authored-by: Dan Gould <d@ngould.dev>

`InMemoryTestPerister` now becomes generic over what events it is
storing in memory allowing for other rust-payjoin mods to test storing
and replaying session logs. We expose the in-memory session persister
under a new feature flag: `_test-utils`.

We also re-export the in-memory session persister through the
payjoin-test-utils crate and added a crates-io patch
making it available to other workspace members that use
payjoin-test-utils at version 0.0.0.
@arminsabouri arminsabouri requested a review from spacebear21 June 11, 2025 17:17
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 15591349719

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 85.626%

Totals Coverage Status
Change from base Build 15590217987: 0.004%
Covered Lines: 7029
Relevant Lines: 8209

💛 - Coveralls

@DanGould
Copy link
Contributor

Fixing the workspace path defs could be its own commit for clarity since those changes aren't directly related to the export, but you may consider that a nitpick.

pub type BoxSendSyncError = Box<dyn std::error::Error + Send + Sync>;

pub use payjoin::persist::test_utils::InMemoryTestPersister;
pub use payjoin::persist::SessionPersister;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be exported in payjoin-test-utils? It should be available from the payjoin crate already afaict

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I don't have strong opnions about this. I am not sure how non-workspace entities are consuming test-utils. So I would defer to you @spacebear21.

I will say: it is a bit cleaner to have all testutils consolidated and re-exported from one crate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that SessionPersister should be considered a test util since it's a core payjoin trait. Presumably a tester would just use InMemoryTestPersister as is, or they'd be testing their actual persister which itself already implements SessionPersister. I don't feel strongly about it though so will merge this as is.

Copy link
Collaborator

@spacebear21 spacebear21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 85d6c71

@arminsabouri arminsabouri merged commit a70f5e8 into payjoin:master Jun 11, 2025
7 checks passed
@arminsabouri arminsabouri deleted the move-inmem-session-persister branch June 11, 2025 23:58
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.

4 participants