The BatchUploadFixture tests were randomly failing when uncommenting the lines executing a GET request to check the file upload status.
Failure was on assertion about the status code returned by the POST request following the GET request: for instance 500 instead of 308 in testChunkedUpload.
Error was "Cannot add chunk with index 2 to file entry XXX as it already exists." because the POST request was sent twice.
Why was the POST request sent twice?
Because an error was occurring in the HTTP communication and an appropriate response was not received from the server after sending the GET request. Since the sun.net.http.retryPost system property is true by default, the HTTP client implementation of JDK would resend the POST request, see http://itdoc.hitachi.co.jp/manuals/3020/30203Y2310e/EY230208.HTM.
NXP-18317 to disable this property in tests and at runtime. Indeed, when setting it to false in this test we could trace the SocketException from the malformed response to the GET request instead of letting the test continue.
Note that NXP-18310 was created to allow posting twice the same chunk without failing.
Why was the GET request sending a malformed response (visible in Wireshark)?
Because the Content-Length response header was not equal to the real content length, see https://github.com/nuxeo/nuxeo/commit/0f21342e51ef9510c5705981d49f80829902c3ac for the appropriate fix.