Skip to content
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

test(crypto): Add some basic snapshot testing in crypto crate #4449

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

BillCarsonFr
Copy link
Member

Adding some snapshot testing for the crypto test.

Another benefit of insta is we see right away how things are serialised, and 2 findings here:

  • KnownSenderData serializes the master_key as an array of numbers in json :/

  • BackupDecryptionKey does it too, but it is never serialized by itself (but using serialize_with). It probably doesn't need to be serializable by itself?

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@BillCarsonFr BillCarsonFr requested review from a team as code owners December 20, 2024 15:56
@BillCarsonFr BillCarsonFr requested review from bnjbvr and poljar and removed request for a team December 20, 2024 15:56
Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Very nice, thanks.

let decryption_key = BackupDecryptionKey { inner: Box::new([1u8; 32]) };
assert_json_snapshot!(decryption_key);

// should not log the key !
Copy link
Contributor

Choose a reason for hiding this comment

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

Neat.

@BillCarsonFr BillCarsonFr force-pushed the valere/add_some_crypto_insta_snapshot_tests branch from 01bf4ba to 4e6c060 Compare December 20, 2024 18:03
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.05%. Comparing base (667a8e6) to head (4e6c060).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4449      +/-   ##
==========================================
+ Coverage   85.03%   85.05%   +0.01%     
==========================================
  Files         283      283              
  Lines       31748    31748              
==========================================
+ Hits        26998    27002       +4     
+ Misses       4750     4746       -4     

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

@poljar poljar merged commit adb4428 into main Dec 20, 2024
41 checks passed
@poljar poljar deleted the valere/add_some_crypto_insta_snapshot_tests branch December 20, 2024 18:52
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