Skip to content

test(file-service): cover DatasetResource path validation - #6701

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
Ma77Ball:test/dataset-resource-path-spec
Jul 22, 2026
Merged

test(file-service): cover DatasetResource path validation#6701
aglinxinyuan merged 1 commit into
apache:mainfrom
Ma77Ball:test/dataset-resource-path-spec

Conversation

@Ma77Ball

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • Add DatasetResourcePathSpec, a lightweight unit spec calling the companion validateAndNormalizeFilePathOrThrow directly.
  • Cover the empty-path, normalize-to-null, absolute-path, and normalized-relative-path branches.

Any related issues, documentation, discussions?

Closes: #6700

How was this PR tested?

  • Run: sbt "FileService/testOnly *DatasetResourcePathSpec", expect all 7 tests passing.
  • Test-only change; no production code is modified.

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.8 in compliance with ASF

@github-actions github-actions Bot added the platform Non-amber Scala service paths label Jul 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds focused ScalaTest unit coverage for DatasetResource.validateAndNormalizeFilePathOrThrow, improving confidence in file-path validation behavior within the file-service without relying on the heavier DatasetResourceSpec integration harness.

Changes:

  • Introduce a new lightweight spec that directly exercises validateAndNormalizeFilePathOrThrow.
  • Add tests covering null/empty/whitespace inputs, normalization-to-null invalid traversal, absolute-path rejection, and relative-path normalization behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 22, 2026
@aglinxinyuan
aglinxinyuan removed this pull request from the merge queue due to a manual request Jul 22, 2026
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 22, 2026
Merged via the queue into apache:main with commit 9ff12c3 Jul 22, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit test coverage for DatasetResource path validation

3 participants