Skip to content

refactor(test): Extract common crypto mock server helper #5005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented May 6, 2025

Draft because it is a follow up of #4998
Extracted a helper to create a wiremock server that allows to perform full end to end encryption tests.

Note: In the existing verification test there was a known_devices list, but this was not used (the test work fine if you remove it), so I removed it when extracting the mock helpers

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@BillCarsonFr BillCarsonFr changed the base branch from main to valere/crypto/to_device_encrypt_helper May 6, 2025 08:55
Comment on lines +92 to +101
pub struct MatrixKeysMockServer {
/// The underlying [`wiremock`] [`MockServer`]
pub server: MockServer,
keys: Arc<Mutex<Keys>>,
token_to_user_id_map: Arc<Mutex<BTreeMap<String, OwnedUserId>>>,
token_counter: AtomicU32,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't really incorporate the Keys struct into MatrixMockServer instead it creates another mock server concept with much less functionality.

I don't think we'd want to have two of those.

Base automatically changed from valere/crypto/to_device_encrypt_helper to main May 19, 2025 11:20
@BillCarsonFr BillCarsonFr force-pushed the valere/crypto/extract_crypto_mockserver_helper branch from 50829d3 to cf13d30 Compare May 19, 2025 12:45
Copy link

codecov bot commented May 19, 2025

Codecov Report

Attention: Patch coverage is 68.39623% with 67 lines in your changes missing coverage. Please review.

Project coverage is 85.73%. Comparing base (21de891) to head (cf13d30).

Files with missing lines Patch % Lines
...ates/matrix-sdk/src/test_utils/mocks/encryption.rs 68.39% 67 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5005      +/-   ##
==========================================
- Coverage   85.82%   85.73%   -0.10%     
==========================================
  Files         325      326       +1     
  Lines       35984    36196     +212     
==========================================
+ Hits        30883    31032     +149     
- Misses       5101     5164      +63     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants