Skip to content

Commit

Permalink
Extend test for newer and older Jenkins versions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed Nov 3, 2024
1 parent c8695d9 commit ac0d625
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/src/test/java/hudson/jobs/CreateItemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@
import hudson.model.ItemGroup;
import hudson.model.ListView;
import hudson.model.listeners.ItemListener;
import hudson.util.VersionNumber;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.text.MessageFormat;
import jenkins.model.Jenkins;
import org.htmlunit.HttpMethod;
import org.htmlunit.Page;
import org.htmlunit.WebRequest;
Expand Down Expand Up @@ -112,10 +114,14 @@ public void testCreateItemDoesNotPopulateDefaultView() throws Exception {

// Confirm new job is not visible in default view
assertTrue(aView.isDefault()); // a-view is still the default view
// TODO: When JENKINS-74795 is fixed, this assertion will pass
// assertThat(aView.getItems(), containsInAnyOrder(aJob));
// TODO: Until JENKINS-74795 is fixed, this assertion passes (a bug)
assertThat(aView.getItems(), containsInAnyOrder(aJob, b2Job));
VersionNumber jenkinsVersion = Jenkins.getVersion();
if (jenkinsVersion == null || jenkinsVersion.isOlderThan(new VersionNumber("2.475"))) {
// TODO: When JENKINS-74795 is fixed, this assertion will pass
assertThat(aView.getItems(), containsInAnyOrder(aJob));
} else {
// TODO: Until JENKINS-74795 is fixed, this assertion passes (a bug)
assertThat(aView.getItems(), containsInAnyOrder(aJob, b2Job));
}
}

@Issue("JENKINS-31235")
Expand Down

0 comments on commit ac0d625

Please sign in to comment.