Turns out in the new executor on-demand code, queue maintenance happens so quickly that even when a job is submitted with delay 0,
it can still fail the test if the check happens when "new GregorianCalendar()" returns the same value as "top.timestamp".
I'm relaxing that check
JENKINS-16194 and an analogous but opposite bug fixed more simply by introducing a separate NONE constant.
Also numberOnDisk did not get updated properly after a build was deleted, causing double loading of build records in some cases.
And ignoring an occasionally failing test:
https://jenkins.ci.cloudbees.com/job/core/job/jenkins_main_trunk/1198/testReport/junit/hudson.model/UpdateCenter2Test/testInstall/
Sep 16, 2013 12:39:53 PM com.gargoylesoftware.htmlunit.html.HtmlPage loadJavaScriptFromUrl
SEVERE: Error loading JavaScript from [http://localhost:50727/update-center.json?id=default&version=1.532-SNAPSHOT%20(private-09%2F16%2F2013%2015%3A35%20GMT-jenkins)].
java.io.IOException: GET http://localhost:50727/update-center.json?id=default&version=1.532-SNAPSHOT%20(private-09%2F16%2F2013%2015%3A35%20GMT-jenkins) failed
at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:130)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1456)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1387)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:988)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:953)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:359)
at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:223)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:556)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:487)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:451)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:522)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:458)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:918)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:182)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:200)
at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:619)
at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:886)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536)
at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:891)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1133)
at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:177)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:456)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:332)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:389)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374)
at org.jvnet.hudson.test.HudsonTestCase$WebClient.goTo(HudsonTestCase.java:1811)
at org.jvnet.hudson.test.HudsonTestCase$WebClient.goTo(HudsonTestCase.java:1802)
at org.jvnet.hudson.test.HudsonTestCase$WebClient$goTo.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at hudson.model.UpdateCenter2Test.testInstall(UpdateCenter2Test.groovy:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:176)
at org.jvnet.hudson.test.HudsonTestCase.runTest(HudsonTestCase.java:428)
at junit.framework.TestCase.runBare(TestCase.java:141)
at org.jvnet.hudson.test.HudsonTestCase.runBare(HudsonTestCase.java:290)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:101)
... 55 more