You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2019/01/08 16:49:24 UTC

[flink] 11/12: [hotfix] [core] Assert current serializer snapshot is expected snapshot class in TypeSerializerSnapshotMigrationTestBase

This is an automated email from the ASF dual-hosted git repository.

tzulitai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 25dc4832324bb0be0731747c5856441a6b984a95
Author: Tzu-Li (Gordon) Tai <tz...@apache.org>
AuthorDate: Thu Dec 6 19:14:17 2018 +0800

    [hotfix] [core] Assert current serializer snapshot is expected snapshot class in TypeSerializerSnapshotMigrationTestBase
    
    This strengthens the test base to make use of the provided snapshot
    class in the test specifications, to assert that serializers are really
    using the expected classes for their current serializer snapshots.
---
 .../common/typeutils/TypeSerializerSnapshotMigrationTestBase.java   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotMigrationTestBase.java b/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotMigrationTestBase.java
index 186f504..ea18309 100644
--- a/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotMigrationTestBase.java
+++ b/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotMigrationTestBase.java
@@ -103,6 +103,8 @@ public abstract class TypeSerializerSnapshotMigrationTestBase<ElementT> extends
 		TypeSerializer<ElementT> restoredSerializer = previousSnapshot.restoreSerializer();
 
 		TypeSerializerSnapshot<ElementT> nextSnapshot = restoredSerializer.snapshotConfiguration();
+		assertThat(nextSnapshot, instanceOf(testSpecification.snapshotClass));
+
 		TypeSerializerSnapshot<ElementT> nextSnapshotDeserialized = writeAndThenReadTheSnapshot(restoredSerializer, nextSnapshot);
 
 		assertThat(nextSnapshotDeserialized, allOf(
@@ -247,6 +249,10 @@ public abstract class TypeSerializerSnapshotMigrationTestBase<ElementT> extends
 			return resourcePath(this.snapshotDataLocation);
 		}
 
+		public Class<? extends TypeSerializerSnapshot<T>> getSnapshotClass() {
+			return snapshotClass;
+		}
+
 		@Override
 		public String toString() {
 			return String.format("%s , %s, %s", name, serializerType.getSimpleName(), snapshotClass.getSimpleName());