mengw15 opened a new issue, #7498:
URL: https://github.com/apache/texera/issues/7498
### Task Summary
Two small backend utilities have unhit branches (~18 uncovered lines total):
`VFSURIFactory`'s URI-validation guards and `UserActivityTracker`'s database
write path. Both already have specs. **Goal: bring both files to full
coverage** — add the cases below and use the coverage report to catch anything
remaining. `AnyFlatSpec` + `Matchers`.
### Behavior to add
**VFSURIFactory**
(`common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/VFSURIFactory.scala`,
~83%, 8 lines) — pure, no infra
- `createNonResultVFSURI`'s guard clauses are unhit. Assert both the
`IllegalArgumentException` and its message for each:
- `resourceType = RESULT` passed to the non-result path ("resourceType
cannot be RESULT …")
- a **runtime-statistics** URI that carries an `operatorId` ("Runtime
statistics URI should not contain operatorId.")
- a **console-messages** URI that omits the `operatorId` ("Console
messages URI should contain operatorId.")
- Cover the happy path for each non-result resource type so the constructed
`URI` shape is pinned, and round-trip through `decodeURI` asserting the
components come back unchanged.
**UserActivityTracker**
(`common/auth/src/main/scala/org/apache/texera/auth/UserActivityTracker.scala`,
~71%, 10 lines)
- The uncovered block is the **default upsert path** — the one that actually
writes the activity row (it builds the timestamp and runs the jOOQ upsert),
plus the surrounding claim/cooldown arms. The existing spec injects a fake
recorder, which is why this arm is never taken.
- Cover it with a `MockTexeraDB` setup (`with MockTexeraDB`,
`initializeDBAndReplaceDSLContext()` in `beforeAll`, seed a user via `UserDao`)
and drive `markActive` through the **real** default upsert: assert the row is
written, and that a second `markActive` within the cooldown does not write
again while one after the window does.
- Keep the clock injected (the class takes a time supplier) so no assertion
depends on wall-clock time — never assert on `Instant.now()`.
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]