apache / apache/lucene

Make BaseTokenStreamTestCase.checkRandomData more debuggable [LUCENE-3900]

Open
#4,973 1 comment 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:task
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

This thing has gotten meaner recently, but if it fails, it can be tough to debug.

I feel like usually we just look at whatever analyzer failed, and completely review the code
and look for any smells until it passes :)

So I think instead we can possibly make this easier if this does something like:

```Java
try {
...checks...
} catch (Throwable t) {
BaseTokenException e = new BaseTokenException(randomInputUsed, randomParamter1, randomParameter2);
e.setInitCause(t);
throw e;
}
```

Then you could have a useful exception with the input string that caused the fail,
information about whether or not charfilter/mockreaderwrapper/whatever were used, etc,
as well as the initial problem as root cause.

---
Migrated from [LUCENE-3900](https://issues.apache.org/jira/browse/LUCENE-3900) by Robert Muir (@rmuir), 1 vote

Contributor guide

Open the contributing guide

Research direction

Start by locating BaseTokenStreamTestCase.checkRandomData and reviewing how its random input and parameters are generated and how checks currently fail. The work is done when failures preserve the random input and relevant parameters while retaining the original Throwable as the root cause, making analyzer failures easier to reproduce and debug.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.