Skip to content

Commit

Permalink
Exclude HTMLUnit failing assertion in Jenkins 2.400 and later
Browse files Browse the repository at this point in the history
jenkinsci/bom#1959 (comment)
explains that the modernization of hetero-list.js has inserted JavaScript
that the HTMLUnit JavaScript engine does not understand.  That causes
the test to fail with an HTTP 500 error when the specific assertion
is executed.

Do not execute the failing assertion on Jenkins 2.400 and
later.  Excluding the failing assertion is a simple short-term
workaround for the larger problem that is described by @basil in
jenkinsci/jenkins-test-harness#569 (comment)
  • Loading branch information
MarkEWaite committed Apr 14, 2023
1 parent aaceeb6 commit 073f9dd
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import hudson.plugins.git.SubmoduleConfig;
import hudson.plugins.git.UserRemoteConfig;
import hudson.plugins.git.extensions.GitSCMExtension;
import hudson.util.VersionNumber;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -77,7 +78,10 @@ public class LibraryStepTest {
scmSource.setCredentialsId(""); // TODO the setter ought to use fixEmpty
s.setRetriever(new SCMSourceRetriever(scmSource));
s.setChangelog(true);
r.assertEqualDataBoundBeans(s, stepTester.configRoundTrip(s));
// TODO Assertion fails with 2.400 and later due to outdated JavaScript support in HTMLUnit
if (r.jenkins.get().getVersion().isOlderThan(new VersionNumber("2.400"))) {
r.assertEqualDataBoundBeans(s, stepTester.configRoundTrip(s));
}
// TODO uninstantiate works but SnippetizerTester.assertRoundTrip fails due to differing SCMSource.id values
assertEquals("library identifier: 'foo@master', retriever: modernSCM([$class: 'GitSCMSource', credentialsId: '', remote: 'https://nowhere.net/', traits: [gitBranchDiscovery()]])", Snippetizer.object2Groovy(s));
s.setRetriever(new SCMRetriever(new GitSCM(Collections.singletonList(new UserRemoteConfig("https://nowhere.net/", null, null, null)),
Expand Down

0 comments on commit 073f9dd

Please sign in to comment.