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

chore: data format snapshot tests #314

Merged
merged 16 commits into from
Aug 17, 2023
Merged

Conversation

appcypher
Copy link
Member

@appcypher appcypher commented Jul 24, 2023

This PR adds snapshot tests for the data format of WNFS.
The tests are identifiable by their encapsulating module, snapshot_tests.

This PR implements the following features

  • Snapshot tests for wnfs data format

Test plan (required)

  • Snapshot tests

    cargo install cargo-insta
    
    cargo insta test --check -- snapshot_tests    
  • Testing

    scripts/rs-wnfs test

Closing issues

@appcypher appcypher marked this pull request as ready for review July 31, 2023 23:10
@appcypher appcypher requested a review from a team as a code owner July 31, 2023 23:10
@appcypher
Copy link
Member Author

appcypher commented Aug 1, 2023

Deciding to push exhaustive tree history snapshotting the to another PR.

@appcypher appcypher force-pushed the appcypher/data-format-tests branch from 9f6bf3b to 4f93b5b Compare August 1, 2023 17:20
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #314 (fa14342) into main (380ee8c) will increase coverage by 1.22%.
The diff coverage is 65.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #314      +/-   ##
==========================================
+ Coverage   56.33%   57.56%   +1.22%     
==========================================
  Files          43       45       +2     
  Lines        3172     3271      +99     
  Branches      770      806      +36     
==========================================
+ Hits         1787     1883      +96     
+ Misses        891      845      -46     
- Partials      494      543      +49     
Files Changed Coverage Δ
wnfs-common/src/metadata.rs 17.64% <ø> (ø)
wnfs-common/src/utils/common.rs 61.53% <ø> (ø)
wnfs-hamt/src/hamt.rs 40.00% <ø> (+12.50%) ⬆️
wnfs-hamt/src/node.rs 50.00% <0.00%> (+3.33%) ⬆️
wnfs-hamt/src/pointer.rs 21.87% <ø> (+15.62%) ⬆️
wnfs-nameaccumulator/src/name.rs 81.06% <ø> (ø)
wnfs/src/private/directory.rs 68.86% <ø> (+0.42%) ⬆️
wnfs/src/private/forest/hamt.rs 49.52% <ø> (+4.76%) ⬆️
wnfs/src/private/node/keys.rs 78.94% <ø> (ø)
wnfs/src/private/node/serializable.rs 0.00% <ø> (ø)
... and 15 more

... and 1 file with indirect coverage changes

@matheus23
Copy link
Member

Wasm tests error out weirdly:

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
Error:   --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wait-timeout-0.2.0/src/lib.rs:66:9
   |
66 |         imp::wait_timeout(self, dur)
   |         ^^^ use of undeclared crate or module `imp`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `wait-timeout` (lib) due to previous error
Error: warning: build failed, waiting for other jobs to finish...
❌ [compile] Failed with exit status 101

@appcypher
Copy link
Member Author

The suggestions given by the nightly linter are incorrect and I'm not sure what is causing it.

@matheus23
Copy link
Member

Hmm. Related to this? rust-lang/rust-clippy#11179

Nightly should be the latest latest clippy though, right? That issue seems to be fixed already. Is it a clippy regression?

@matheus23
Copy link
Member

matheus23 commented Aug 3, 2023

If we can't manage to fix the issue, can we add a bunch of allow annotations so we get rid of these errors?
Ideally as local as possible for exactly these parameters

@appcypher
Copy link
Member Author

Or we could ignore the errors since it is likely going to fix itself in the future.
We don't want to sprinkle allows in the code for sth that isn't a real problem.

@matheus23
Copy link
Member

Or we could ignore the errors since it is likely going to fix itself in the future.
We don't want to sprinkle allows in the code for sth that isn't a real problem.

Hmmm. As long as these directives are very local, I think they're not too bad.
I don't want us to get used to the ❌ on main. We'd have to check exactly which error it is in the logs everytime to make sure we're not ignoring some error that's more important.

If you think about it: In both cases we're ignoring errors. In one case we're ignoring them for the whole project, in the other we're ignoring them for only a couple of methods.
Perhaps we can set us a reminder to check back in a month to see if we can remove the allow annotations?

@appcypher
Copy link
Member Author

needless_pass_by_mut_ref does not exist on stable yet.

@matheus23
Copy link
Member

Ugh. That's so annoying

Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

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

Awesome stuff! Thanks so much.

There's some nits, some naming suggestions, one weird output, but I trust you with the rest :)

@matheus23 matheus23 mentioned this pull request Jul 26, 2023
6 tasks
@appcypher appcypher merged commit ca8798b into main Aug 17, 2023
@appcypher appcypher deleted the appcypher/data-format-tests branch August 17, 2023 17:12
@appcypher appcypher self-assigned this Aug 25, 2023
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