You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2023/11/20 02:01:00 UTC

[jira] [Resolved] (CXF-8959) Detect order dependent flakiness in AttachmentUtilTest.java in core module

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

Andriy Redko resolved CXF-8959.
-------------------------------
    Resolution: Fixed

> 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)