You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "OrDTesters (GitHub)" <gi...@apache.org> on 2018/11/21 21:51:38 UTC

[GitHub] [incubator-dubbo] OrDTesters opened pull request #2815: Fixing test-order dependency for FstObjectInputTest

## What is the purpose of the change

When tests in FstObjectOutputTest, e.g., testWriteInt, runs right before FstObjectInputTest, FstObjectInputTest fails. There is some state from FstObjectInput that is preserved between the test runs that leads to FstObjectInputTest to fail when run afterwards.

The proposed fix is a patch that I found can help reset the state so FstObjectInputTest does not fail when run afterwards. The patch is based off of FstObjectOutputTest.testWriteBool, which indirectly resets the state itself. As such, another potential patch is to use the entire testWriteBool logic in the tearDown method:
```
@After
public void tearDown() throws IOException {
    this.byteArrayOutputStream = new ByteArrayOutputStream();
    this.fstObjectOutput = new FstObjectOutput(byteArrayOutputStream);
    this.fstObjectOutput.writeBool(false);
    this.flushToInput();
}
```

I would be happy to discuss other ways of fixing the issue.

## Brief changelog

dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectOutputTest.java

## Verifying this change

```
mvn test -pl dubbo-serialization/dubbo-serialization-test/ -Dtest=FstObjectOutputTest#testWriteInt,FstObjectInputTest -DfailIfNoTests=false
```
fails before the change. The same command will pass after the change.


[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2815 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] OrDTesters commented on pull request #2815: Fixing test-order dependency for FstObjectInputTest

Posted by "OrDTesters (GitHub)" <gi...@apache.org>.
Thank you for the suggestions. Unfortunately, calling neither of the two methods helped here, the command still fails when using these two methods in the tearDown. It seems there is still some other state that these clear methods do not help reset.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2815 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 commented on issue #2815: Fixing test-order dependency for FstObjectInputTest

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
let's move it in for now, as long as it is stable.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2815 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 closed pull request #2815: Fixing test-order dependency for FstObjectInputTest

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
[ pull request closed by beiwei30 ]

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2815 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 commented on pull request #2815: Fixing test-order dependency for FstObjectInputTest

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
not sure whether `org.nustaq.serialization.FSTConfiguration#clearGlobalCaches` and `org.nustaq.serialization.FSTConfiguration#clearCaches` do the tricks.

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2815 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 commented on pull request #2815: Fixing test-order dependency for FstObjectInputTest

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
why a `new FstObjectInput()` is necessary in tearDown method?

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/2815 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org