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

[JENKINS-69650] Fix test reporting of Security2779Test #7134

Merged
merged 4 commits into from
Sep 26, 2022

Conversation

MarkEWaite
Copy link
Contributor

@MarkEWaite MarkEWaite commented Sep 20, 2022

JENKINS-69650 Fix test reporting of Security2779Test

Apache Maven surefire plugin does not seem to fully support parameterized JUnit 4 tests. See junit-team/junit5#990 for discussion of the issue.

The surefire plugin acts as though the Security2779Test is being run multiple times with the same argument and treats a failure of one argument as a "flaky test". In this case, the test is not flaky as far as I can tell, it is showing a real failure when the argument is "#icon-panel svg".

The test passes consistently when the argument is "#link-panel a".

The consistent failures that I've seen were on Red Hat Enterprise Linux 8.6 with Eclipse Temurin Java 11.0.16.1. The same failure was seen in the Jenkins 2.369 weekly build.

This commit does not fix the failure, it just makes it easier to see that there is a failure.

It appears that the parameterized test started failing for the '#icon-panel svg' with commit 3923e45 in pull request #7052. See the bisection command used in JENKINS-69650

Proposed changelog entries

  • No changelog - test related only

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadoc, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO") if applicable.
  • New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content-Security-Policy directives (see documentation on jenkins.io).
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@NotMyFault, @daniel-beck

Maintainer checklist

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

  • There are at least 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 does not block the change
  • Changelog entries in the PR 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, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (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).

Apache Maven surefire plugin does not seem to fully support parameterized
JUnit 4 tests.  See junit-team/junit5#990 for
discussion of the issue.

The surefire plugin acts as though the Security2779Test is being run
multiple times with the same argument and treats a failure of one argument
as a "flaky test".  In this case, the test is not flaky as far as I can
tell, it is showing a real failure when the argument is "#icon-panel svg".

The test passes consistently when the argument is "#link-panel a".

The consistent failures that I've seen were on Red Hat Enterprise Linux
8.6 with Eclipse Temurin Java 11.0.16.1.  The same failure was seen in
the Jenkins 2.369 weekly build.

This commit does not fix the failure, it just makes it easier to see
that there is a failure.
@MarkEWaite MarkEWaite changed the title [JENKINS-69650] Make Security2779Test failure easier to diagnose [JENKINS-69650] Simplify Security2779Test diagnosis Sep 20, 2022
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

@Parameterized is often a mess. Simpler & clearer (IMO) to get rid of it and just have one test method run assertions on both selectors. Or define two @Test methods which simply delegate to a private implementation.

Make the test failure explicit and visible in the build log
@NotMyFault NotMyFault added the skip-changelog Should not be shown in the changelog label Sep 21, 2022
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Thanks!

@daniel-beck daniel-beck self-assigned this Sep 21, 2022
@daniel-beck
Copy link
Member

While 84f41d2 in 2.370 addresses the failure, this change is still worthwhile.

@jglick
Copy link
Member

jglick commented Sep 21, 2022

The surefire plugin acts as though the Security2779Test is being run multiple times with the same argument and treats a failure of one argument as a "flaky test".

This sounds like SUREFIRE-2087 though that is reported for JUnit 5. I wonder if the same applies to JUnit 4? Or we caused a 5-specific bug to start affecting our codebase by introducing the 5 libraries with the vintage engine? It would be nice if someone could reproduce this in a self-contained test case using 4 (with or without 5 in the classpath) and comment accordingly in SUREFIRE-2087.

@MarkEWaite MarkEWaite changed the title [JENKINS-69650] Simplify Security2779Test diagnosis [JENKINS-69650] Fix test reporting of Security2779Test Sep 21, 2022
@MarkEWaite
Copy link
Contributor Author

@daniel-beck and @NotMyFault are there additional changes needed for this pull request before it is approved and starts the 24 hour countdown timer to merge?

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.

Looks good, no review or merge blocker from my side.

Thanks for taking care of it :)

@timja
Copy link
Member

timja commented Sep 25, 2022

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

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 Sep 25, 2022
@MarkEWaite MarkEWaite merged commit 7e9a475 into jenkinsci:master Sep 26, 2022
@MarkEWaite MarkEWaite deleted the fix-Security2779Test branch September 26, 2022 14:35
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
Development

Successfully merging this pull request may close these issues.

5 participants