aglinxinyuan opened a new pull request, #6134:
URL: https://github.com/apache/texera/pull/6134
### What changes were proposed in this PR?
Adds unit-test coverage for the two local-git dataset version-control
utilities in `common/workflow-core`
(`org.apache.texera.amber.core.storage.util.dataset`), which Codecov reports as
almost entirely uncovered:
- **`JGitVersionControlSpec`** (new) — drives `JGitVersionControl` against a
temp git repo: `initRepo` (happy path + already-exists guard), `add`/`commit`
(40-hex hash), `getRootFileNodeOfCommit` with a top-level file and a nested
directory (sizes + relative paths, including subtree recursion),
`readFileContentOfCommitAsInputStream`/`AsOutputStream` round-trips, the guard
branches on both read methods (outside-repo path, in-repo directory, missing
file), `rm`, and `hasUncommittedChanges`/`discardUncommittedChanges`.
- **`GitVersionControlLocalFileStorageSpec`** (extended) — adds a full
versioned lifecycle (`initRepo` → `writeFileToRepo` → `withCreateVersion` →
`retrieveRootFileNodesOfVersion` →
`retrieveFileContentOfVersion`/`AsInputStream` →
`writeVersionedFileToTempFile`), plus
`hasUncommittedChanges`/`discardUncommittedChanges` and `removeFileFromRepo`
(directory guard + delete). The existing `deleteRepo` test and its
`deleteIfExists` helper are reused.
No production code is changed; this is test-only.
Note: `JGitVersionControl.add` stages via
`repoPath.relativize(filePath).toString()`, whose pathspec uses the OS
separator; JGit's matcher rejects the Windows `dir\file` form, so nested-path
staging in the tests is done with the portable `add(".")` pattern, and temp-dir
teardown is best-effort (JGit can hold Windows file handles). Both are
test-side accommodations; behavior on the Linux CI path is unchanged.
### Any related issues, documentation, discussions?
Coverage gaps identified from the Codecov report for `apache/texera`.
### How was this PR tested?
New/extended ScalaTest specs, run locally:
```
sbt "WorkflowCore/testOnly *JGitVersionControlSpec
*GitVersionControlLocalFileStorageSpec"
```
All 16 pass. `scalafmt` and `scalafixAll --check` are clean.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])
--
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]