fix flaky test#1517
Conversation
| IOUtils.copyAndCloseInput(in, bos); | ||
| String result = bos.toString(); | ||
| assertTrue("Expect the SOAPService", result.indexOf("<service name=\"SOAPService\">") > 0); | ||
| assertTrue("Expect the SOAPService", result.indexOf("<service name=\"SOAPService\">") > 0 |
There was a problem hiding this comment.
This might be an issue I believe, CXF should return consistent response (either qualified or unqualified namespaces), the test should not try to adapt to that.
|
We investigated the root cause of the flaky test as @reta suggested — CXF should return consistent WSDL output rather than the test adapting to inconsistency. The issue is in A fix has been submitted in #2944 (switching to |
|
Closing this PR — the root cause of the flaky test has been identified and fixed in #2944 (non-deterministic namespace prefix assignment in Thanks @prathyushreddylpr for reporting the issue! |
Description
Fixed the flaky test
testGetWsdlinsideNettyServerTest.javaclass.cxf/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/NettyServerTest.java
Line 86 in 3048785
Root Cause
The test
testGetWsdlhas been reported as flaky when run with the NonDex tool. The test failed because it is trying to find if a certain element(<service name"SOAPService">) is present inside the XML file which is returned by calling WSDL service. But there is slight change in the content of XML returned by the service. For example, in some cases the XML returned contained elements with:wsdlprefix. So instead of<service name"SOAPService">, the XML content contained<wsdl:service name"SOAPService">. As a result the test is failed.Fix
After debugging the code, it is clear that XML content with
wsdl:prefix, means that the elements are qualified by the namespace, and when you see the same tags without the prefix, the XML is still using the WSDL namespace, but it's defined as the default namespace, so the prefix is not necessary. So, the test is fixed by adding a condition to check if the element withwsdl:is present.How this has been tested?
Java: openjdk version "11.0.20.1"
Maven: Apache Maven 3.6.3
Command used -
Command used -
Command used -
NonDex test passed after the fix.