Skip to content

Fix: Make tests deterministic #95

Merged
AnomalRoil merged 1 commit intodrand:mainfrom
alienx5499:fix/issue34-deterministic-tests
Nov 13, 2025
Merged

Fix: Make tests deterministic #95
AnomalRoil merged 1 commit intodrand:mainfrom
alienx5499:fix/issue34-deterministic-tests

Conversation

@alienx5499
Copy link
Copy Markdown
Contributor

This PR resolves issue #34 by making tests deterministic and removing network dependencies for the short test suite.

Changes

Skip network-dependent tests in short mode

Added testing.Short() checks to skip network-dependent tests when running go test -short:

  • TestEarlyDecryptionWithDuration
  • TestEarlyDecryptionWithRound
  • TestDecryptVariousChainhashes
  • TestDecryptStrict
  • TestInteropWithJS
  • Test_WrapUnwrap

Add deterministic test vectors

Added two new deterministic test functions that use fixed network data without requiring network access:

  • TestDeterministicEncryptionDecryption - Tests encryption/decryption using the tlock API
  • TestDeterministicTimeLock - Tests TimeLock/TimeUnlock functions directly

Interop tests

The existing TestInteropWithJS already provides interop testing with tlock-js library using known test vectors.

Testing

  • go test -short ./... - All tests pass, network tests skipped
  • go test ./... - All tests pass, including network tests

Benefits

  • Faster test runs in CI/CD (use go test -short)
  • Deterministic test vectors for reliable testing
  • No network dependency for most tests
  • Easy to run tests without internet connectivity

Closes #34

Copy link
Copy Markdown
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

@AnomalRoil AnomalRoil merged commit 962ec50 into drand:main Nov 13, 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.

Make tests deterministic

2 participants