Do not use static state variables in Extension class by gbhat618 · Pull Request #389 · jenkinsci/github-plugin

Flakiness in the test was identified (possibly) due to the use of static stateful fields in the @Extension class. See this comment for details. Issue was likely parallel test execution mutating the state of static field.

This PR addresses the issue following the comment here.

Note: This problem only affects tests and does not impact Jenkins functionality. Whether the data is stored in a static cache or within a field inside a singleton instance, it effectively centralizes event data in one place.

Testing done

  • Automated tests still executing correctly.
  • Manual testing
    • verify the duplicate events monitor functionality is correct as before (tested by sending duplicate events - admin monitor comes, restart jenkins - monitor goes away)

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