Skip to content

Add tests for error handling and retry scenarios in RegistryWireMockTest#165

Merged
jonesbusy merged 1 commit intooras-project:mainfrom
vaidikcode:add_WireMock_Tests
Feb 28, 2025
Merged

Add tests for error handling and retry scenarios in RegistryWireMockTest#165
jonesbusy merged 1 commit intooras-project:mainfrom
vaidikcode:add_WireMock_Tests

Conversation

@vaidikcode
Copy link
Copy Markdown
Contributor

Signed-off-by: vaidikcode vaidikbhardwaj00@gmail.com

Description

Issue #23

This PR improves test coverage for the Registry client by adding three new test methods:

shouldHandle500Error: Tests the client's ability to properly handle HTTP 500 errors from the registry and convert them into OrasExceptions with the correct status code.

shouldHandleTimeout: Tests the client's handling of HTTP 408 (Request Timeout) responses, ensuring that timeout conditions are properly propagated as OrasExceptions.

shouldRetryBlobUpload: Implements scenario-based testing using WireMock to verify that the client can successfully retry blob uploads after an initial server error. This test demonstrates the retry capability of the Registry client when pushing content.

Testing done

Tests run successfully in isolation and in sequence
Some existing test failures in other classes are unrelated to these changes

Submitter checklist

  • I have read and understood the CONTRIBUTING guide
  • I have run mvn license:update-file-header, mvn spotless:apply, pre-commit run -a, mvn clean install before opening the PR

@vaidikcode
Copy link
Copy Markdown
Contributor Author

I attempted to run tests in parallel, but they remain flaky. I also used dynamic ports and even tried reinitializing WireMock instances. No luck finding why they remain flaky.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.16%. Comparing base (ccaf165) to head (9211ba6).
Report is 8 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #165      +/-   ##
============================================
+ Coverage     82.82%   83.16%   +0.34%     
- Complexity      299      308       +9     
============================================
  Files            26       27       +1     
  Lines          1077     1093      +16     
  Branches        104      105       +1     
============================================
+ Hits            892      909      +17     
+ Misses          130      129       -1     
  Partials         55       55              

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

Comment thread src/test/java/land/oras/RegistryWireMockTest.java Outdated
Comment thread src/test/java/land/oras/RegistryWireMockTest.java Outdated
@jonesbusy
Copy link
Copy Markdown
Collaborator

Can you ensure all commits are signed? Ideally the PR need to be rebased and only one commmits must be present (for such small change). When done I will merge

Thanks

Copy link
Copy Markdown
Collaborator

@jonesbusy jonesbusy left a comment

Choose a reason for hiding this comment

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

Commit is not signed

Signed-off-by: vaidikcode <vaidikbhardwaj00@gmail.com>
@vaidikcode
Copy link
Copy Markdown
Contributor Author

Commit is not signed

Done

@jonesbusy jonesbusy merged commit 784ba03 into oras-project:main Feb 28, 2025
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.

2 participants