cpugputpu created FLINK-16230:
--------------------------------- Summary: Use LinkedHashMap instead of HashMap for a deterministic order when testing serialization Key: FLINK-16230 URL: https://issues.apache.org/jira/browse/FLINK-16230 Project: Flink Issue Type: Bug Environment: TEST: org.apache.flink.api.java.typeutils.runtime.kryo.KryoGenericTypeSerializerTest#testJavaSet StackTrace: java.util.HashMap$HashIterator$HashIteratorShuffler.<init> java.util.HashMap$HashIterator.<init>(HashMap.java:1435) java.util.HashMap$KeyIterator.<init>(HashMap.java:1467) java.util.HashMap$KeySet.iterator(HashMap.java:917) java.util.HashSet.iterator(HashSet.java:173) org.apache.flink.testutils.DeeplyEqualsChecker.deepEqualsIterable(DeeplyEqualsChecker.java:107) org.apache.flink.testutils.DeeplyEqualsChecker.deepEquals0(DeeplyEqualsChecker.java:94) org.apache.flink.testutils.DeeplyEqualsChecker.lambda$deepEquals$0(DeeplyEqualsChecker.java:79) java.util.Optional.orElseGet(Optional.java:267) org.apache.flink.testutils.DeeplyEqualsChecker.deepEquals(DeeplyEqualsChecker.java:79) org.apache.flink.testutils.CustomEqualityMatcher.matches(CustomEqualityMatcher.java:63) org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:12) org.junit.Assert.assertThat(Assert.java:956) org.apache.flink.api.common.typeutils.SerializerTestBase.deepEquals(SerializerTestBase.java:493) org.apache.flink.api.common.typeutils.SerializerTestBase.testSerializedCopyIndividually(SerializerTestBase.java:379) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.apache.flink.api.common.typeutils.SerializerTestInstance.testAll(SerializerTestInstance.java:92) org.apache.flink.api.java.typeutils.runtime.AbstractGenericTypeSerializerTest.runTests(AbstractGenericTypeSerializerTest.java:155) org.apache.flink.api.java.typeutils.runtime.kryo.KryoGenericTypeSerializerTest.testJavaSet(KryoGenericTypeSerializerTest.java:59) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) org.junit.runners.ParentRunner.run(ParentRunner.java:363) org.junit.runners.Suite.runChild(Suite.java:128) org.junit.runners.Suite.runChild(Suite.java:27) org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) org.junit.runners.ParentRunner.run(ParentRunner.java:363) org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55) org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137) org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107) org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83) org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75) org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158) org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) Reporter: cpugputpu The test in org.apache.flink.api.java.typeutils.runtime.kryo.KryoGenericTypeSerializerTest.testJavaSet(KryoGenericTypeSerializerTest.java:59) may fail due to a different iteration order of HashSet. The test aims to check the serializer of HashSet. It will invokeĀ org.apache.flink.testutils.DeeplyEqualsChecker.deepEqualsIterable(DeeplyEqualsChecker.java:107), where theĀ iterator of HashSet is called. However, the HashSet makes no guarantee about the order it iterates, finally causing an assertion failure. The fix is to use LinkedHashSet to make the test more stable. -- This message was sent by Atlassian Jira (v8.3.4#803005) |
Free forum by Nabble | Edit this page |