You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/06/07 12:59:12 UTC

[GitHub] [shardingsphere-elasticjob] y553546436 opened a new issue #1900: Flaky unit tests in GsonFactoryTest (non-idempotent)

y553546436 opened a new issue #1900:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1900


   ## Bug Report
   
   ### Expected behavior
   
   Test `org.apache.shardingsphere.elasticjob.infra.json.GsonFactoryTest.assertRegisterTypeAdapter` should not pollute the state shared among tests, to prevent test dependency issues (i.e., a new test in the future could be flaky and fail when run after it due to the state pollution).
   
   ### Actual behavior
   
   The test pollutes the state shared among tests. If run twice in the same JVM, the test would fail in the second run because the state pollution causes itself to fail.
   
   ### Reason analyze (If you can)
   
   The test pollutes some state shared among tests, causing the second test run to fail for assertions on the `GsonFactory`. The second run of `org.apache.shardingsphere.elasticjob.infra.json.GsonFactoryTest.assertRegisterTypeAdapter` fails for the following assertion:
   
   ```
   Failed tests: 
     GsonFactoryTest.assertRegisterTypeAdapter:53 
   Expected: is "{}"
        but: was "test"
   ```
   
   ### Steps to reproduce the behavior.
   
   Run the test twice in the same JVM. The second test run would fail. For example, one can make a duplicate of the method in the class like this:
   ```
   @Test
   public void assertRegisterTypeAdapterDuplicate() {
       assertRegisterTypeAdapter();
   }
   ```
   and then use maven to run the test class:
   ```
   mvn test -pl elasticjob-infra/elasticjob-infra-common -am -Dtest=org.apache.shardingsphere.elasticjob.infra.json.GsonFactoryTest -DfailIfNoTests=false
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN closed issue #1900: Flaky unit tests in GsonFactoryTest (non-idempotent)

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #1900:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1900


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN closed issue #1900: Flaky unit tests in GsonFactoryTest (non-idempotent)

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #1900:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1900


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org