Skip to content

test(workflow-core): add unit test coverage for StorageUtil#4761

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:xinyuan-test-storage-util-spec
May 3, 2026
Merged

test(workflow-core): add unit test coverage for StorageUtil#4761
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:xinyuan-test-storage-util-spec

Conversation

@aglinxinyuan
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add StorageUtilSpec covering the loan-pattern wrappers in StorageUtil:

  • withReadLock, withWriteLock, and withLock execute the block and return its value
  • Each wrapper releases the underlying lock even when the block throws

Any related issues, documentation, discussions?

Closes #4759

How was this PR tested?

sbt "WorkflowCore/testOnly org.apache.texera.amber.core.storage.util.StorageUtilSpec" — 6/6 tests pass.

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

Generated-by: Claude Code (Claude Opus 4.7)

Add StorageUtilSpec covering the loan-pattern wrappers withReadLock,
withWriteLock, and withLock: each executes the block and returns its
value, and each releases the underlying lock even when the block
throws.

Closes apache#4759

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 coverage for StorageUtil’s loan-pattern lock wrappers in common/workflow-core, validating both normal-return behavior and lock release on exceptions (per #4759).

Changes:

  • Introduces StorageUtilSpec covering withReadLock, withWriteLock, and withLock.
  • Verifies each wrapper returns the block’s value.
  • Verifies locks are released even when the wrapped block throws.

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

@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.44%. Comparing base (99b0963) to head (abbdcf3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #4761   +/-   ##
=========================================
  Coverage     43.43%   43.44%           
- Complexity     2056     2057    +1     
=========================================
  Files           957      957           
  Lines         34077    34077           
  Branches       3753     3753           
=========================================
+ Hits          14802    14804    +2     
+ Misses        18477    18475    -2     
  Partials        798      798           
Flag Coverage Δ
access-control-service 28.12% <ø> (ø)
amber 41.74% <ø> (ø)
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.

@aglinxinyuan aglinxinyuan requested a review from Yicong-Huang May 3, 2026 01:59
@aglinxinyuan aglinxinyuan enabled auto-merge (squash) May 3, 2026 08:22
@aglinxinyuan aglinxinyuan merged commit b6f682c 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 test coverage for StorageUtil

4 participants