apache / apache/shenyu

[BUG] Whole test body wrapped in catch (Throwable) {} (always green)

Open Beginner friendly
#6,593 1 comment 0 reactions 0 assignees View on GitHub
in: test priority: high type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
Both LRU/TinyLFU eviction tests put the entire logic + all `assertEquals` inside a try whose catch is `// just ignore`. Any `AssertionError`/NPE/logic bug is silently discarded -> test is green no matter what. Comment admits "results … not stable, just ignore".

## Location
```
shenyu-common/src/test/java/org/apache/shenyu/common/cache/MemorySafeLRUMapTest.java:40-65
shenyu-common/src/test/java/org/apache/shenyu/common/cache/MemorySafeWindowTinyLFUMapTest.java:73-76
```

## Impact
Core cache eviction correctness is effectively unverified.

## Suggested fix
Remove the try/catch; if memory-stability genuinely matters, isolate that one assertion behind `@Disabled` or `Assumptions.assumeTrue`, not a blanket swallow.

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with shenyu-common/src/test/java/org/apache/shenyu/common/cache/MemorySafeLRUMapTest.java lines 40-65 and MemorySafeWindowTinyLFUMapTest.java lines 73-76. Run the two cache eviction tests, then inspect the try/catch around the assertions and preserve only any specifically justified memory-stability assumption. Done means assertion failures and unexpected errors make the tests fail rather than being swallowed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.