apache / apache/druid

Usage of `new Random(constant seed)` in tests

Open
#6,227 3 comments 0 reactions 0 assignees View on GitHub
Area - Testing Contributions Welcome stale
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

On the one hand, it's good because it makes the tests 100% deterministic and test failures reproducible.

On the other hand, compared to `ThreadLocalRandom.current()` or `new Random(seed)` with a _random_ seed, a constant seed may not allow to explore all input conditions and discover some failing corner cases.

So ideally the seed should be generated randomly and be a *parameter* of a test, recorded in the test name. So when a test fails, it could be run locally with the known seed parameter in order to reproduce a test failure.

Contributor guide

Open the contributing guide

Research direction

The issue does not name specific files, tests, or entry points. Start by locating Druid tests that use new Random with a constant seed, then assess how seeds could be generated and recorded as test parameters while preserving reproducibility; done means the relevant tests explore varied seeds and report a failing seed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.