KeepAliveCache being used when junit ant task being run through TeamCity

Hi there,

We've noticed that the following test passes when it is invoked via intellij, but fails when invoked on any of our TeamCity agents (via ant in both cases):

public class KeepAliveTest extends TestCase {
    public void test() {
        for (Thread thread: Thread.getAllStackTraces().keySet()) {
            if (thread.getName().contains("Keep-Alive-Timer")) {
                fail("not sure why this thread is running");
            }
        }
    }
}

Some googling tells me that this thread belongs to sun.net.www.http.KeepAliveCache and is used to cache idle HTTP connections.  I'd like to know why it gets used when the test is run through TeamCity but not when run through intellij.  I can provide details relating to the ant target/TeamCity configuration as required.

Thanks
Amy

3 comments
Comment actions Permalink

Some of the TeamCity classes are in the same JVM where tests are being executed, these classes are required to send information about tests progress to the agent.

0
Comment actions Permalink

OK, is there any way to run the tests through TeamCity without whatever aspect of TeamCity is causing the use of the KeepAliveCache?  We think this thread is causing some of our performance tests to fail.

Thanks
Amy

0
Comment actions Permalink

Try to add this system property to your build configuration:
teamcity.ant.junit-support.enabled=true

This will disable automatic JUnit tests reporting. It would be interesting to know whether your performance tests are really affected by this.
If so, as a workaround you can add "XML report processing" build feature and specify there JUnit xml reports.

0

Please sign in to leave a comment.