Skip to content

Conversation

@alienx5499
Copy link
Contributor

Summary

Stabilizes a flaky test by trimming trailing CR/LF from both the decrypted bytes and the expected loremBytes before comparison. This prevents a 1-byte mismatch caused by platform-dependent line endings.

Rationale

  • Some environments produce \r\n vs \n, causing the test to fail with lengths 1063 vs 1064.
  • Normalizing trailing newlines keeps the intent of the test intact while making it deterministic across platforms.

Changes

  • Update TestDecryptVariousChainhashes in tlock_test.go to:
    • Trim trailing \r and \n from both byte slices prior to equality check.
    • Keep the original failure message semantics, now reporting normalized lengths when failing.

Scope

  • Tests only. No production code changes.

Testing

  • Ran go test ./... locally; all packages pass.

Risks

  • Very low. Comparison is only loosened for trailing newline characters; content integrity checks remain strict.

Notes

  • Kept the commit focused to avoid go.mod/go.sum churn.

Copy link
Member

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

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

Lgtm. Thanks for the fix

@AnomalRoil AnomalRoil merged commit 26b7cc5 into drand:main Sep 10, 2025
1 check passed
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