[ 
https://issues.apache.org/jira/browse/CXF-8959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andriy Redko updated CXF-8959:
------------------------------
    Affects Version/s: 4.0.3
                       3.6.2
                       3.5.7

> 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
>    Affects Versions: 3.5.7, 3.6.2, 4.0.3
>            Reporter: Ruby
>            Priority: Minor
>             Fix For: 3.5.8, 3.6.3, 4.0.4
>
>         Attachments: failure.png
>
>
> 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 generated (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 calling 
> 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 then. 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)

Reply via email to