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 unit tests for PrioritySorterRestriction class to address JENKINS-69757 #408

Conversation

LobsterRavioli
Copy link
Contributor

@LobsterRavioli LobsterRavioli commented Nov 24, 2024

This pull request introduces unit tests for the PrioritySorterRestriction class to address the issue outlined in JENKINS-69757.
These tests ensure the class functions correctly and handles various scenarios, such as missing ItemInfo and priority range validations.
These tests increase the code coverage of the code-base.

Testing done

  • Automated tests were implemented to ensure complete coverage of the PrioritySorterRestriction logic:
    • testCanTake_MissingItemInfo: Verifies behavior when ItemInfo is absent in the QueueItemCache.
    • testCanTake_PriorityRange: Tests canTake behavior for different priority values, validating edge conditions.
    • testGetterMethods: Ensures the correctness of getter methods and that canTake works with Run objects.
      Screenshot From 2024-11-24 19-51-04
      Screenshot From 2024-11-24 20-38-04

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@LobsterRavioli LobsterRavioli requested a review from a team as a code owner November 24, 2024 19:48
@github-actions github-actions bot added the tests Automated test addition or improvement label Nov 24, 2024
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Tests look good. Thanks!

@MarkEWaite MarkEWaite merged commit 9f19217 into jenkinsci:master Nov 27, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Automated test addition or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants