Skip to content

Fix TestJiraLink unit tests failing with HTTP 503#4699

Open
vaibhavdaren wants to merge 2 commits intomainfrom
vaibhav-ci-tests-fix
Open

Fix TestJiraLink unit tests failing with HTTP 503#4699
vaibhavdaren wants to merge 2 commits intomainfrom
vaibhav-ci-tests-fix

Conversation

@vaibhavdaren
Copy link
Contributor

The three TestJiraLink tests were making real network requests to https://issues.redhat.com/rest/api/2/serverInfo because the jira.JIRA() constructor validates the connection on init. Only add_simple_link was mocked, so the constructor hit the live server and failed with 503.

Fix by mocking the entire jira.JIRA class instead of individual methods. This prevents the constructor from running at all, fully isolates the tests from the network, and removes the need for a separate init mock.

Tests on pull request were failing :

  1. Expose typing.override #4676
  2. Add a new feature plugin to verify package installation #4660

vaibhavdaren and others added 2 commits March 15, 2026 07:18
The three TestJiraLink tests were making real network requests to
https://issues.redhat.com/rest/api/2/serverInfo because the jira.JIRA()
constructor validates the connection on init. Only add_simple_link was
mocked, so the constructor hit the live server and failed with 503.

Fix by mocking the entire jira.JIRA class instead of only add_simple_link.
This prevents the constructor from making any network call and fully
isolates the tests from the network.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the repeated @patch decorators from each test method to the class
level. All three tests share the same two mocks, so applying them once
at the class level reduces duplication and makes it easier to add
new tests in the future.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vaibhavdaren vaibhavdaren added this to the 1.70 milestone Mar 15, 2026
@vaibhavdaren vaibhavdaren requested review from LecrisUT and thrix March 15, 2026 02:13
@vaibhavdaren vaibhavdaren self-assigned this Mar 15, 2026
@vaibhavdaren vaibhavdaren added the ci | full test Pull request is ready for the full test execution label Mar 15, 2026
@github-project-automation github-project-automation bot moved this to backlog in planning Mar 15, 2026
@vaibhavdaren vaibhavdaren moved this from backlog to review in planning Mar 15, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes failing unit tests by mocking the jira.JIRA class to prevent network requests during test initialization. My review includes a suggestion to refactor repeated mock decorators to the class level for improved code clarity and maintainability.

@vaibhavdaren vaibhavdaren force-pushed the vaibhav-ci-tests-fix branch 2 times, most recently from 5de2db6 to 34ed888 Compare March 15, 2026 02:25
@vaibhavdaren vaibhavdaren marked this pull request as ready for review March 15, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution

Projects

Status: review

Development

Successfully merging this pull request may close these issues.

1 participant