Skip to content

test(amber): add unit tests for SleepOpDesc, IntersectOpDesc, URLFetcherOpDesc#4816

Merged
aglinxinyuan merged 4 commits into
apache:mainfrom
Yicong-Huang:test-opdesc-bundle
May 3, 2026
Merged

test(amber): add unit tests for SleepOpDesc, IntersectOpDesc, URLFetcherOpDesc#4816
aglinxinyuan merged 4 commits into
apache:mainfrom
Yicong-Huang:test-opdesc-bundle

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Adds scalatest coverage for three logical-operator descriptors that had no dedicated specs:

  • sleep/SleepOpDesc — operatorInfo (Sleep, Control group, 1 input + 1 output) and getPhysicalOp (non-parallelizable, single-worker, SleepOpExec class wired in).
  • intersect/IntersectOpDesc — operatorInfo (Intersect, Set group, 2 input ports with PortIdentity 0/1, blocking output) and getPhysicalOp (HashPartition required on both inputs, derived HashPartition for any input combination).
  • source/fetcher/URLFetcherOpDesc — operatorInfo (URL Fetcher, API group, source-shaped 0-in/1-out), sourceSchema (UTF-8 → STRING, RAW_BYTES → ANY, null fallthrough → ANY), and getPhysicalOp (URLFetcherOpExec class wired in).

Any related issues, documentation, discussions?

Closes #4814.

Bug filed separately: URLFetcherOpDesc.sourceSchema silently falls back to ANY when decodingMethod is left at its null default rather than guarding non-null. Pinned in the spec as the current behavior.

Drive-by note (already filed as #4813): source/scan/json/JSONUtil.scala is a byte-for-byte duplicate of workflow-core/util/JSONUtils.scala::JSONToMap. Not adding a redundant spec for it; its tests live with JSONUtilsSpec from #4716.

How was this PR tested?

sbt scalafmtCheckAll
sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.sleep.SleepOpDescSpec org.apache.texera.amber.operator.intersect.IntersectOpDescSpec org.apache.texera.amber.operator.source.fetcher.URLFetcherOpDescSpec"

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

Generated-by: Claude Code (claude-opus-4-7)

…herOpDesc

Closes apache#4814

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.96%. Comparing base (0de0ec2) to head (31052af).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #4816   +/-   ##
=========================================
  Coverage     43.95%   43.96%           
- Complexity     2131     2138    +7     
=========================================
  Files           957      957           
  Lines         34072    34068    -4     
  Branches       3753     3753           
=========================================
+ Hits          14977    14978    +1     
+ Misses        18308    18301    -7     
- Partials        787      789    +2     
Flag Coverage Δ
access-control-service 28.12% <ø> (ø)
amber 42.93% <ø> (+0.31%) ⬆️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 0.00% <ø> (ø)
file-service 33.24% <ø> (ø)
workflow-compiling-service 47.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds ScalaTest unit specs for three Amber logical operator descriptors (SleepOpDesc, IntersectOpDesc, URLFetcherOpDesc) to improve WorkflowOperator module coverage and pin current descriptor/physical-op wiring behavior.

Changes:

  • Add SleepOpDescSpec validating operator metadata and non-parallelizable single-worker physical-op settings.
  • Add IntersectOpDescSpec validating metadata, hash partition requirements, and derived output partition behavior.
  • Add URLFetcherOpDescSpec validating metadata, decoding-dependent sourceSchema, and basic physical-op wiring.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/fetcher/URLFetcherOpDescSpec.scala Adds descriptor-level tests for URL Fetcher operatorInfo, sourceSchema branches, and physical-op wiring.
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/sleep/SleepOpDescSpec.scala Adds descriptor-level tests for Sleep operatorInfo and physical-op flags/class wiring.
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/intersect/IntersectOpDescSpec.scala Adds descriptor-level tests for Intersect operatorInfo, partition requirements, and exec wiring.

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

…n check

- Replace `physical.opExecInitInfo.toString should include(...)` in the
  Sleep, Intersect, and URLFetcher specs with a pattern match on
  `OpExecWithClassName(className, _)` plus `className shouldBe FQCN`,
  so the assertions only fail on actual wiring changes (not on scalapb
  toString formatting).
- Guard the URLFetcher default-decodingMethod test with an explicit
  `schema.getAttributes should have length 1` before `.head` so a
  future shape change surfaces a meaningful failure instead of a bare
  `NoSuchElementException`.
- Promote the URLFetcher schema-propagation test from a port-count
  comparison to actually invoking `physical.propagateSchema.func` and
  asserting the returned mapping contains the output port id with a
  schema equal to `op.sourceSchema()`.
@aglinxinyuan aglinxinyuan enabled auto-merge (squash) May 3, 2026 08:06
@aglinxinyuan aglinxinyuan merged commit 5cf0e7b into apache:main May 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for SleepOpDesc, IntersectOpDesc, URLFetcherOpDesc

4 participants