mengw15 opened a new issue, #7697:
URL: https://github.com/apache/texera/issues/7697
### Task Summary
Three backend classes are missing **branch** coverage rather than line
coverage — their lines execute, but one arm of a `match` or a conditional never
does. Codecov computes `coverage = hits / lines` and does not count a
partially-covered line as a hit, so these cost real percentage points: roughly
**+6.9pp / +6.5pp / +9.3pp** on the respective files.
**Goal: take the untaken arms so each file reaches full coverage.** All
three already have a spec; extend it and re-run the coverage report to confirm
the partials cleared. `AnyFlatSpec` + `Matchers`.
Note on reading the report: scoverage marks *every* `case` label partial,
and many of those are instrumentation noise (the label shows partial while its
body on the next line is a hit). The cases listed below were filtered to the
ones whose **body is also uncovered**, so each is a genuinely untaken arm.
### Behavior to add
**AttributeTypeUtils**
(`common/workflow-core/src/main/scala/org/apache/texera/amber/core/tuple/AttributeTypeUtils.scala`,
~90%, 12 real partials) — pure, no infra
- The parse-fallback chain: `case None => tryParseLong(...)` /
`tryParseTimestamp(...)` / `tryParseDouble(...)` / `tryParseBoolean(...)`. Each
of these arms is reached only when the *preceding* parse attempt returns
`None`, so feed values that fail the earlier parser and succeed at the later
one (e.g. a string that is not an Int but is a Long; not a Long but a Double; a
boolean literal; an ISO timestamp), plus a value that fails every parser.
- `case AttributeType.ANY | _ => field` — pass an `ANY`-typed field and an
unrecognised type so the catch-all arm runs and returns the field unchanged.
**AdminExecutionResource**
(`amber/src/main/scala/org/apache/texera/web/resource/dashboard/admin/execution/AdminExecutionResource.scala`,
~85%, 6 real partials) — jOOQ; the spec already uses `MockTexeraDB`
- The status-code `match` in `mapToStatus`: `"READY" => 0`, `"RUNNING" =>
1`, `"PAUSED" => 2`, `"COMPLETED" => 3` and the remaining arms. Call it once
per status string, including an unknown status so the default arm runs. This is
a pure mapping — no DB row is needed for it.
- Any remaining conditional in the listing query — seed executions in the
states the untaken arms describe.
**NotebookMigrationResource**
(`notebook-migration-service/src/main/scala/org/apache/texera/service/resource/NotebookMigrationResource.scala`,
~86%, 15 real partials) — jOOQ; the spec already uses `MockTexeraDB`
- `if (conn != null) conn.disconnect()` — cover both the connected and
never-connected paths of the cleanup.
- `case NonFatal(e) => logger.error("Error sending notebook to Jupyter", e)`
— make the outbound call fail (stub the boundary it calls, do not reach a real
Jupyter) and assert the failure is handled rather than propagated.
- `case Right(w) => w` and its `Left` counterpart — drive the
`Either`-returning path with both a success and a failure value.
- Cover the remaining untaken arms the coverage report shows after the above.
### 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]