Myrna van Lunteren created DERBY-6101:
-----------------------------------------
Summary: NetworkServerTestSetup.getTimeoutErrorMsg may get reflect
wrong port number
Key: DERBY-6101
URL: https://issues.apache.org/jira/browse/DERBY-6101
Project: Derby
Issue Type: Bug
Components: Test
Affects Versions: 10.10.0.0
Reporter: Myrna van Lunteren
Priority: Trivial
The method NetworkServerTestSetup.getTimeoutErrorMsg(String) was modified with
revisions 1448441 (for DERBY-6085) and 1448941 (DERBY-6012) to show the port
number and hostname on timeout. This is very helpful.
However, it gets the port number from config, and this may not always be the
portnumber in use.
I ran into this by making a mistake in the setUp() method of
DerbyNetAutoStartTest, my attempt at converting DerbyNetAutoStart (see
DERBY-3838). I did not have an engine shutdown instruction in the setUp.
The following code (simplified) caused showed the problem:
int theport = TestConfiguration.getCurrent().getNextAvailablePort()
System.out.println("the port is " + theport);
NetworkServerControl ns =
NetworkServerTestSetup.getNetworkServerControl(theport);
NetworkServerTestSetup.waitForServerStart(ns);
When running with -Dderby.tests.basePort=4100, the port obtained with
getNextAvailablePort() was 4104. However, the timeout error message reflects
the basePort. I got:
junit.framework.AssertionFailedError: Timed out waiting for network server to
start (localhost:4100)
at junit.framework.Assert.fail(Assert.java:47)
at
org.apache.derbyTesting.junit.NetworkServerTestSetup.waitForServerStart(NetworkServerTestSetup.java:565)
at
org.apache.derbyTesting.functionTests.tests.derbynet.DerbyNetAutoStartTest.startNetworkServerTrueHelper(DerbyNetAutoStartTest.java:143)
I'll attach the test at this point in time, to see the behavior, one needs to
comment out the line in the setUp() method:
//TestConfiguration.getCurrent().shutdownEngine();
The test will pass if the engine is shutdown.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira