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

test(cssc): 30926545 add unit test for workflow status, fix style issues (1/n) #21

Open
wants to merge 12 commits into
base: feature/cssc_ext
Choose a base branch
from

Conversation

cegraybl
Copy link

Will split the unit test changes into multiple PRs, as there are other code changes that require tests and are under review.

The focus of this PR are:

  • Add unit tests to workflow status (list command)
  • Fix all style issues
  • Fix all lint issues
  • Set the correctly the supported python versions
  • Add more tests for cron validation.

Copy link

@Copilot 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.

Copilot reviewed 5 out of 11 changed files in this pull request and generated 1 comment.

Files not reviewed (6)
  • src/acrcssc/azext_acrcssc/tests/latest/test_cssc_scenario.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/helper/_taskoperations.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/tests/latest/test_helper_taskoperations.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/tests/latest/test_validators.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/_validators.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/helper/_workflow_status.py: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/acrcssc/azext_acrcssc/helper/_utility.py:44

  • The function name was changed from 'transform_cron_to_schedule' to 'convert_cron_to_schedule'. Ensure all references to the old function name are updated.
def convert_cron_to_schedule(cron_expression, just_days=False):

src/acrcssc/azext_acrcssc/helper/_utility.py:24

  • The new error condition introduced in 'convert_timespan_to_cron' should be covered by tests.
raise InvalidArgumentValueError(error_msg=ERROR_MESSAGE_INVALID_TIMESPAN_VALUE)

src/acrcssc/azext_acrcssc/helper/_ociartifactoperations.py:232

  • The type annotation for 'tags' should be 'List[str]' instead of 'str'.
tags: str

@cegraybl cegraybl requested a review from Copilot February 21, 2025 01:06

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 11 changed files in this pull request and generated no comments.

Files not reviewed (6)
  • src/acrcssc/azext_acrcssc/tests/latest/test_cssc_scenario.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/tests/latest/test_helper_taskoperations.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/helper/_taskoperations.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/tests/latest/test_validators.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/_validators.py: Evaluated as low risk
  • src/acrcssc/azext_acrcssc/helper/_workflow_status.py: Evaluated as low risk
Comments suppressed due to low confidence (5)

src/acrcssc/azext_acrcssc/tests/latest/test_workflow_Status.py:31

  • [nitpick] The method name 'test__task_status_to_workflow_status' has a double underscore, which is unconventional. Consider renaming it to 'test_task_status_to_workflow_status'.
def test__task_status_to_workflow_status(self):

src/acrcssc/azext_acrcssc/tests/latest/test_workflow_Status.py:82

  • Ensure that the regex patterns used in the '_get_image_from_tasklog' method are correctly handling all possible log formats.
def test_get_image_from_tasklog(self):

src/acrcssc/azext_acrcssc/tests/latest/test_workflow_Status.py:95

  • Verify that the '_get_errors_from_tasklog' method is correctly identifying and sorting unique errors.
def test_get_patch_error_reason_from_tasklog(self):

src/acrcssc/azext_acrcssc/tests/latest/test_workflow_Status.py:111

  • Ensure that the '_retrieve_all_tasklogs' and '_get_missing_taskrun' methods are correctly mocked and tested.
def test_from_taskrun(self, mock_retrieve_all_tasklogs, mock_get_missing_taskrun):

src/acrcssc/azext_acrcssc/tests/latest/test_workflow_Status.py:239

  • Verify that the 'get_sdk' and '_download_logs' methods are correctly mocked and tested.
def test_generate_logs(self, mock_core_get_sdk, mock_wf_get_sdk, mock_download_logs):
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.

1 participant