matiaskorhonen / paper-age

Easy and secure paper backups of secrets
MIT License
411 stars 8 forks source link

Decrease test_stdout's expected size: 400 -> 200 KiB #97

Closed tomfitzhenry closed 10 months ago

tomfitzhenry commented 10 months ago

Motivation: Make cargo test --release pass. This is useful for NixOS packaging, because NixOS tests against a release binary.

Currently the 'test_stdout' fails with --release, since the test expects the PDF to be > 400KiB, but the release PDF is 337 KiB.

Here we see the debug binary outputting 516 KB:

$ echo STDOUT | PAPERAGE_PASSPHRASE=secret cargo run  -- -o - | wc --bytes
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s
     Running `target/debug/paper-age -o -`
515997

Here we see the release binary outputting 337KB:

$ echo STDOUT | PAPERAGE_PASSPHRASE=secret cargo run --release  -- -o - | wc --bytes
    Finished release [optimized] target(s) in 0.41s
     Running `target/release/paper-age -o -`
336980

So let's decrease the test limit. I guess the value of the test is mostly in checking that the PDF isn't less than < 10KB. The PDFs are visually indistinguishable from my eye.

codecov[bot] commented 10 months ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (11ce28c) 95.71% compared to head (fe5f165) 95.71%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #97 +/- ## ======================================= Coverage 95.71% 95.71% ======================================= Files 7 7 Lines 677 677 ======================================= Hits 648 648 Misses 29 29 ``` | [Files](https://app.codecov.io/gh/matiaskorhonen/paper-age/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matias+Korhonen) | Coverage Δ | | |---|---|---| | [tests/cli.rs](https://app.codecov.io/gh/matiaskorhonen/paper-age/pull/97?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matias+Korhonen#diff-dGVzdHMvY2xpLnJz) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 10 months ago

PaperAge visual snapshots

Compare the output of the latest release version of PaperAge with the results from the current commit.

Latest release Current commit Diff
A4 A4 release A4 current A4 diff
Letter Letter release Letter current Letter diff

Encryption passphrase: supersecret

Note: Snapshots are deleted after 30 days.

matiaskorhonen commented 10 months ago

Thanks. Yeah, the test is there just a sanity check to ensure that the output is at least plausible…

matiaskorhonen commented 10 months ago

@tomfitzhenry FYI, I just released v1.1.4 which includes your changes.

tomfitzhenry commented 10 months ago

@tomfitzhenry FYI, I just released v1.1.4 which includes your changes.

Great, thanks for that! :)