Ruby created CXF-8959:
-------------------------
Summary: Detect order dependent flakiness in
AttachmentUtilTest.java in core module
Key: CXF-8959
URL: https://issues.apache.org/jira/browse/CXF-8959
Project: CXF
Issue Type: Bug
Reporter: Ruby
The order dependent flakiness was detected when running multiple test classes.
The polluter that caused the flakiness in AttachmentUtilTest.java was the test
class CachedOutputStreamTest.java. In AttachmentUtilTest, there were multiple
tests that used Mockito.spy() to verify the behavior of CachedOutputStream
object. In those tests, the spy CachedOutputStream object "cos" was generate
(CachedOutputStream cos = spy(CachedOutputStream.class)). Then after this,
there was a line verify(cos).setThreshold(102400L). Therefore, after the cos
being initialized, we need to make sure the setThreshold has been called once.
However, it doens't execute as expected, and the root cause is that the
threshold is not provided when calleing testSetStreamedAttachmentProperties()
method and the thresholdSysPropSet, the boolean that indicated whether the
default threshold has been set or not, has been set to true when we run the
CachedOutputStreamTest.java. Inside the CachedOutputStreamTest.java, the unit
test testUseSysPropsWithAttachmentDeserializer() called the
AttachmentUtil.setStreamedAttachmentProperties(message, cache), so the
thresholdSysPropSet has been set to true. Therefore, if we run
CachedOutputStreamTest.java before running the AttachmentUtilTest.java, the
verify(cos).setThreshold(102400L) statement will lead to the error messageĀ
Wanted but not invoked:
cachedOutputStream.setThreshold(102400L);
-> at
org.apache.cxf.attachment.AttachmentUtilTest.bigIntAsAttachmentMaxSize(AttachmentUtilTest.java:279)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)