]> WPIA git - gigi.git/commit
fix: sometimes various testcases fail
authorFelix Dörre <felix@dogcraft.de>
Sun, 2 Jul 2017 19:04:08 +0000 (21:04 +0200)
committerFelix Dörre <felix@dogcraft.de>
Wed, 5 Jul 2017 17:51:29 +0000 (19:51 +0200)
commitabf7680940d9965011660dc432d44e002d17c1d6
treeaf2e99d85c1ff4f2e9341d685fede35a37e79645
parent20c4322f87aa9abe1cf9147f5734f2df32eb8fa3
fix: sometimes various testcases fail

Sometimes TestCases like club.wpia.gigi.pages.admin
TestSEAdminPageUserMailSearch fail e.g. with CSRFExceptions. I debugged
this issue and have come to a conclusion:

Java's URL connection does not necessarily behave correctly, when
"keep-alive" logic and connection re-use is enabled: When a connection
is re-used and the request sometimes fails on the re-used connection
Java re-attempts to send the request. This might not be a good idea for
POST requests. Especially this is not a good idea, as we track forms
very strictly:
When a form gets requested, the instance is stored in the user's session
and can be submitted exactly once. When this POST request is repeated
the form has been submitted and a subsequent request will cause a
CSRFException. Disabling the retry-logic
is possible but also not a good alternative, as it also causes sporadic
POST-fails, which occur far more often that the retry-logic breaks a
Test Case.

The solution I chose ensures to close all HTTP-connections. Therefore
all HTTP requests use the same connection. This prevents timeouts
and does not cause POST retries. In particular I found problems with the
connection done to clear all caches. Using this change I observe that
all requests are made with the same connection and 100 subsequent
executions don't fail.

Change-Id: I1b4ebce92a431e5d35a81cecd8670b8c37eef9e1
tests/club/wpia/gigi/testUtils/ManagedTest.java