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

TransientActionFactory cache simplification #8048

Merged
merged 3 commits into from
Jun 14, 2023

Conversation

jglick
Copy link
Member

@jglick jglick commented May 25, 2023

Amending #2582 as proposed in #7932 (comment). New implementation is (IMO) simpler and avoids Guava.

Testing done

Just ran TransientActionFactoryTest.

Proposed changelog entries

  • N/A

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@jglick jglick requested a review from Vlatombe May 25, 2023 16:48
@jglick

This comment was marked as resolved.

@NotMyFault NotMyFault added the skip-changelog Should not be shown in the changelog label Jun 8, 2023
Copy link
Member

@NotMyFault NotMyFault left a comment

Choose a reason for hiding this comment

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

/label ready-for-merge


This PR is now ready for merge. We will merge it after ~24 hours if there is no negative feedback.
Please see the merge process documentation for more information about the merge process.
Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Jun 8, 2023
@NotMyFault NotMyFault merged commit eaf9100 into jenkinsci:master Jun 14, 2023
16 checks passed
@jglick jglick deleted the TransientActionFactory branch June 14, 2023 18:03
@basil
Copy link
Member

basil commented Jun 15, 2023

Causes failures in (at least) hudson.plugins.emailext.plugins.recipients.FailingTestSuspectsRecipientProviderTest, hudson.plugins.jacococoveragecolumn.AbstractJaCoCoCoverageColumnTest, hudson.plugins.jacococoveragecolumn.BranchCoverageColumnTest, hudson.plugins.jacococoveragecolumn.JaCoCoColumnTest, and jenkins.scm.api.SCMRevisionActionTest of the following form:

INFO: Expected 1 instance of jenkins.model.TransientActionFactory$Cache but got 0
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.454 s <<< FAILURE! - in hudson.plugins.emailext.plugins.recipients.FailingTestSuspectsRecipientProviderTest
[ERROR] hudson.plugins.emailext.plugins.recipients.FailingTestSuspectsRecipientProviderTest.testAddRecipients  Time elapsed: 1.446 s  <<< ERROR!
java.lang.IllegalStateException: Expected 1 instance of jenkins.model.TransientActionFactory$Cache but got 0
        at hudson.ExtensionList.lookupSingleton(ExtensionList.java:454)
        at jenkins.model.TransientActionFactory.factoriesFor(TransientActionFactory.java:127)
        at hudson.model.Actionable.getAction(Actionable.java:331)
        at hudson.model.Actionable.getAction(Actionable.java:325)
        at hudson.plugins.emailext.plugins.recipients.FailingTestSuspectsRecipientProvider.addRecipients(FailingTestSuspectsRecipientProvider.java:83)
        at hudson.plugins.emailext.plugins.recipients.TestUtilities.checkRecipients(TestUtilities.java:60)
        at hudson.plugins.emailext.plugins.recipients.FailingTestSuspectsRecipientProviderTest.testAddRecipients(FailingTestSuspectsRecipientProviderTest.java:121)

The failures all go away when this change is reverted. The failures all look like more cases of commit 1089a22 (i.e., mocks). The tests could be adapted in the same way, or TransientActionFactory#factoriesFor loosened to support running in mock context along the lines of e.g.

return ExtensionList.lookup(Cache.class).stream()
        .findFirst()
        .map(Cache::cache)
        .map(classValue -> classValue.get(type))
        .map(classValue -> classValue.get(actionType))
        .orElse(List.of());

@jglick
Copy link
Member Author

jglick commented Jun 15, 2023

More transparent to fix the mock tests I think. Will propose some corrections soon if no one beats me to it.

basil added a commit to basil/email-ext-plugin that referenced this pull request Jun 15, 2023
basil added a commit to jenkinsci/email-ext-plugin that referenced this pull request Jun 15, 2023
@basil
Copy link
Member

basil commented Jun 15, 2023

As a courtesy I have released Email Extension 2.99.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog
Projects
None yet
4 participants