hiero-ledger / hiero-ledger/hiero-consensus-node
`hapiTest*` tasks run nearly all tests when invoked with a qualified path
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
## Summary
The `hapiTest*` Gradle tasks in `hedera-node/test-clients/build.gradle.kts` silently fall back to a near-unfiltered test set when invoked with a qualified task path (e.g. `:test-clients:hapiTestClpr`). Only the unqualified form (e.g. `hapiTestClpr`) applies the intended JUnit tag filter.
## Reproduce
From the repo root:
```bash
./gradlew :test-clients:hapiTestClpr
```
Observed: `testSubprocess` executes suites that have no `CLPR` tag, e.g. `com.hedera.services.bdd.suites.blocknode.BlockNodeBackPressureSuite` (tagged `BLOCK_NODE`).
Expected: only suites tagged `CLPR` (excluding `EMBEDDED`/`REPEATABLE`) execute, matching `./gradlew hapiTestClpr`.
## Root cause
In `hedera-node/test-clients/build.gradle.kts`, the tag expression is built by looking up each entry of `gradle.startParameter.taskNames` against the `prCheckTags` map (lines ~290-296):
```kotlin
val ciTagExpression =
gradle.startParameter.taskNames
.stream()
.map { prCheckTags[it] ?: "" }
.filter { it.isNotBlank() }
.toList()
.joinToString("|")
```
`prCheckTags` is keyed by unqualified names (`"hapiTestClpr"`, `"hapiTestCrypto"`, ...), but `startParameter.taskNames` contains whatever was typed on the command line. So invoking `:test-clients:hapiTestClpr` produces a lookup miss, `ciTagExpression` becomes blank, and the `includeTags` block falls through to the empty-expression branch:
```kotlin
if (ciTagExpression.isBlank()) "none()|!(EMBEDDED|REPEATABLE)"
```
which matches essentially everything.
The same pattern is repeated for `prCheckStartPorts`, `prCheckPropOverrides`, `prCheckPlatformOverrides`, `prCheckNetSizeOverrides`, `prCheckPrepareUpgradeOffsets`, and `prCheckTssLibWrapsArtifactsPaths`, so qualified invocations also lose port assignment, property overrides, etc. Affected test tasks include `testSubprocess`, `testSubprocessConcurrent`, `testRemote`, `testEmbedded`, and `testRepeatable`.
## Suggested fix
Normalize task names before lookup, e.g. by using `substringAfterLast(':')` on each entry of `startParameter.taskNames`, so both `hapiTestClpr` and `:test-clients:hapiTestClpr` resolve to the same key. A small helper used in all six lookups would keep the change localized.
## Impact
- Local developers running tag-scoped tasks with a qualified path get a much larger, much slower test run than intended (and with the wrong configuration).
- CI is unaffected today only because it invokes the unqualified form.
Contributor guide
Assessment
This issue has not been assessed yet.