From 08aaf2b9b399b71bd192e5c104c2ff63556a8e69 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 22 Oct 2013 17:38:49 -0400 Subject: [PATCH] Trying to make AsynchPeopleTest more robust. https://jenkins.ci.cloudbees.com/job/core/job/jenkins_main_trunk/1369/testReport/junit/hudson.model/AsynchPeopleTest/display/ org.junit.ComparisonFailure: expected:<[display: none;]> but was:<[]> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at hudson.model.AsynchPeopleTest.display(AsynchPeopleTest.java:44) was presumably a race condition. Could reproduce by adding a Thread.sleep into AsynchPeople.compute. This patch (with waitForBackgroundJavaScript) avoids that error; but causes the assertNotNull at the end to fail, for reasons TBD. --- test/src/test/java/hudson/model/AsynchPeopleTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/src/test/java/hudson/model/AsynchPeopleTest.java b/test/src/test/java/hudson/model/AsynchPeopleTest.java index c83e660e83..135e0e3be2 100644 --- a/test/src/test/java/hudson/model/AsynchPeopleTest.java +++ b/test/src/test/java/hudson/model/AsynchPeopleTest.java @@ -40,7 +40,9 @@ public class AsynchPeopleTest { @Bug(18641) @Test public void display() throws Exception { User.get("bob"); - HtmlPage page = j.createWebClient().goTo("asynchPeople"); + JenkinsRule.WebClient wc = j.createWebClient(); + HtmlPage page = wc.goTo("asynchPeople"); + assertEquals(0, wc.waitForBackgroundJavaScript(120000)); assertEquals("display: none;", page.getElementById("status").getAttribute("style")); assertNotNull(page.getElementById("person-bob")); } -- GitLab