Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8959

Detect order dependent flakiness in AttachmentUtilTest.java in core module

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.5.7, 3.6.2, 4.0.3
    • 3.5.8, 3.6.3, 4.0.4
    • None
    • None
    • Unknown

    Description

      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)

      Attachments

        1. failure.png
          231 kB
          Ruby

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yijujt2 Ruby
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: