Alex Rudyy created QPID-7452:
--------------------------------

             Summary: [Java Tests] URLConnection can be spuriously open twice 
in RestTestHelper whilst making a test HTTP request to the Broker causing test 
failures
                 Key: QPID-7452
                 URL: https://issues.apache.org/jira/browse/QPID-7452
             Project: Qpid
          Issue Type: Bug
          Components: Java Tests
            Reporter: Alex Rudyy


Test 
BDBHAVirtualHostNodeRestTest.testIntruderBDBHAVHNNotAllowedToConnect(BDBHAVirtualHostNodeRestTest
 failed recently with the following error:
{noformat}
Unexpected response code from PUT virtualhostnode/node3 expected:<201> but 
was:<422>

Stacktrace

java.lang.AssertionError: Unexpected response code from PUT 
virtualhostnode/node3 expected:<201> but was:<422>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:743)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at org.junit.Assert.assertEquals(Assert.java:555)
        at 
org.apache.qpid.systest.rest.RestTestHelper.submitRequest(RestTestHelper.java:594)
        at 
org.apache.qpid.server.store.berkeleydb.replication.BDBHAVirtualHostNodeRestTest.testIntruderBDBHAVHNNotAllowedToConnect(BDBHAVirtualHostNodeRestTest.java:252)
{noformat}

The test logs contain records of 2 HTTP requests being made to join the HA node 
to the group whilst test intended to make only one HTTP request.
{noformat}
2016-10-06 22:00:57,857         DEBUG [HttpManagement-http-2022] 
o.a.q.s.m.p.f.LoggingFilter REQUEST  user='null' method='PUT' 
url='http://localhost:51866/api/latest/virtualhostnode/node3'
2016-10-06 22:00:57,860         DEBUG [HttpManagement-http-2038] 
o.a.q.s.m.p.f.LoggingFilter REQUEST  user='null' method='PUT' 
url='http://localhost:51866/api/latest/virtualhostnode/node3'
{noformat}
The first request was successfully completed
{noformat}
2016-10-06 22:00:58,210 DEBUG [HttpManagement-http-2022] 
o.a.q.s.m.p.f.LoggingFilter RESPONSE user='[/127.0.0.1:48747, webadmin]' 
method='PUT' url='http://localhost:51866/api/latest/virtualhostnode/node3' 
status='201'
{noformat} 
The second spurious request had failed
{noformat}
WARN  [HttpManagement-http-2038] o.a.q.s.m.p.s.r.RestServlet 
IllegalConfigurationException processing request 
http://localhost:51866/api/latest/virtualhostnode/node3 from user 
'[/127.0.0.1:48849, webadmin]': Cannot bind to address 'localhost:10002'. 
Address is already in use.
2016-10-06 22:00:58,221         DEBUG [VirtualHostNode-node3-Config] 
o.a.q.s.c.u.TaskExecutorImpl Performing Task['create' on 
'VirtualHost[id=35bb124e-1e4d-4c06-812e-c92c13b0b4d3, 
name=BDBHAVirtualHostNodeRestTest.testIntruderBDBHAVHNNotAllowedToConnect, 
type=BDB_HA_REPLICA]']
2016-10-06 22:00:58,222         DEBUG [HttpManagement-http-2038] 
o.a.q.s.m.p.f.LoggingFilter RESPONSE user='[/127.0.0.1:48849, webadmin]' 
method='PUT' url='http://localhost:51866/api/latest/virtualhostnode/node3' 
status='422'
{noformat}

The client received response with http status code 422 which caused the test 
failure.

It looks like the problem lies in the code used to open URLConnection to the 
broker in RestTestHelper. We need to prevent URLConnection from being opened 
twice.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to