Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vaidikcode
Copy link
Contributor

Signed-off-by: vaidikcode [email protected]

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

Signed-off-by: vaidikcode <[email protected]>
@vaidikcode
Copy link
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.

Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.07%. Comparing base (1a0abbc) to head (20e8a02).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #165      +/-   ##
============================================
+ Coverage     82.52%   83.07%   +0.54%     
- Complexity      294      297       +3     
============================================
  Files            25       25              
  Lines          1093     1093              
  Branches        114      114              
============================================
+ Hits            902      908       +6     
+ Misses          128      126       -2     
+ Partials         63       59       -4     

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

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