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

Enhance IMDS Tests for Improved Code Coverage #5045

Merged
merged 1 commit into from
Jan 3, 2025
Merged

Conversation

gladjohn
Copy link
Contributor

@gladjohn gladjohn commented Jan 2, 2025

Overview

This pull request introduces changes to the Managed Identity tests to enhance code coverage, particularly for error handling scenarios involving HTTP status codes like BadRequest, BadGateway, and GatewayTimeout. The improvements include parameterized tests to efficiently handle multiple scenarios with varied HTTP status responses.

Code Coverage Improvement: From the baseline coverage of 82.74% to 82.86%

image

Changes Proposed

  • Modified ImdsTests to use [DataTestMethod] for handling various HTTP error scenarios in a single consolidated test method.
  • Added multiple mock handlers to simulate retries for GatewayTimeout to reflect real-world behavior and ensure the retry logic is covered.
  • Included test scenarios for BadRequest and BadGateway to ensure proper error handling and logging are in place.

Testing

  • unit tests

Performance Impact

  • None

Documentation

  • N/A

@gladjohn gladjohn requested a review from a team as a code owner January 2, 2025 23:43
@gladjohn gladjohn merged commit 0da69c9 into main Jan 3, 2025
6 checks passed
@gladjohn gladjohn deleted the gladjohn/tc_1 branch January 3, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants