Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Fixing flaky test in MaxBufSizeTest#2291

Open
OrDTesters wants to merge 3020 commits intoalibaba:masterfrom
OrDTesters:MaxBufSizeTest-fix
Open

Fixing flaky test in MaxBufSizeTest#2291
OrDTesters wants to merge 3020 commits intoalibaba:masterfrom
OrDTesters:MaxBufSizeTest-fix

Conversation

@OrDTesters
Copy link
Contributor

The test test_max_buf in MaxBufSizeTest fails when run after SerializeWriterTest_14. The reason is that tests in SerializeWriterTest_14 create SerializeWriter instances of size 1, and the buffer for those instances are cached. When test_max_buf makes a new SerializeWriter instance, it reuses the prior buffer of size 1, and the later call to writer.setMaxBufSize(1) does not throw an exception as expected.

The proposed fix is to have test_max_buf purposely create a valid SerializeWriter, of size 2, such that it is guaranteed for the later exception to be thrown.

VictorZeng and others added 30 commits July 20, 2018 10:07
Improve performance by using StringBuilder instead of StringBuffer.
Performance issue when handling strings
modify the copiright year in the readme file
@OrDTesters OrDTesters closed this Jun 13, 2019
@OrDTesters OrDTesters reopened this Jun 13, 2019
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@745282d). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2291   +/-   ##
=========================================
  Coverage          ?   81.51%           
  Complexity        ?     7029           
=========================================
  Files             ?      143           
  Lines             ?    26183           
  Branches          ?     6262           
=========================================
  Hits              ?    21344           
  Misses            ?     3040           
  Partials          ?     1799

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 745282d...bbe5938. Read the comment docs.

@OrDTesters
Copy link
Contributor Author

@wenshao can you review the pull request, please?

This pull request is similar to three previous ones you reviewed that fixes some flaky tests.
#2290
#2148
#2133

@CLAassistant
Copy link

CLAassistant commented Aug 1, 2019

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

Codecov Report

Merging #2291 into master will decrease coverage by 0.02%.
The diff coverage is 84.09%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2291      +/-   ##
============================================
- Coverage     81.54%   81.51%   -0.03%     
+ Complexity     7045     7029      -16     
============================================
  Files           143      143              
  Lines         26225    26183      -42     
  Branches       6274     6262      -12     
============================================
- Hits          21386    21344      -42     
- Misses         3039     3040       +1     
+ Partials       1800     1799       -1     
Impacted Files Coverage Δ Complexity Δ
.../main/java/com/alibaba/fastjson/JSONException.java 100.00% <ø> (ø) 3.00 <0.00> (ø)
src/main/java/com/alibaba/fastjson/JSONPath.java 75.40% <ø> (-0.27%) 238.00 <0.00> (-13.00)
...main/java/com/alibaba/fastjson/asm/ByteVector.java 91.78% <ø> (ø) 17.00 <0.00> (ø)
...ava/com/alibaba/fastjson/parser/JSONLexerBase.java 71.25% <ø> (-0.04%) 807.00 <0.00> (-1.00)
.../java/com/alibaba/fastjson/parser/JSONScanner.java 76.20% <ø> (-0.17%) 498.00 <0.00> (-2.00)
...on/parser/deserializer/ASMDeserializerFactory.java 97.21% <ø> (ø) 145.00 <0.00> (ø)
...baba/fastjson/serializer/ASMSerializerFactory.java 97.70% <ø> (ø) 211.00 <0.00> (ø)
...m/alibaba/fastjson/serializer/AdderSerializer.java 90.00% <ø> (ø) 4.00 <0.00> (ø)
...a/com/alibaba/fastjson/serializer/AfterFilter.java 100.00% <ø> (ø) 5.00 <0.00> (ø)
...baba/fastjson/serializer/AnnotationSerializer.java 52.72% <ø> (ø) 4.00 <0.00> (ø)
... and 151 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fcc9c2a...bbe5938. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.