[
https://issues.apache.org/jira/browse/FLINK-10097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16667224#comment-16667224
]
ASF GitHub Bot commented on FLINK-10097:
----------------------------------------
azagrebin commented on a change in pull request #6520: [FLINK-10097][DataStream
API] Additional tests for StreamingFileSink
URL: https://github.com/apache/flink/pull/6520#discussion_r228873834
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsTest.java
##########
@@ -40,54 +45,288 @@
public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
@Test
- public void testContextPassingNormalExecution() throws Exception {
- testCorrectPassingOfContext(1L, 2L, 3L);
+ public void testSnapshotAndRestore() throws Exception {
+ final File outDir = TEMP_FOLDER.newFolder();
+ final Path path = new Path(outDir.toURI());
+
+ final RollingPolicy<String, String> onCheckpointRP =
OnCheckpointRollingPolicy.build();
+
+ final Buckets<String, String> buckets = createBuckets(path,
onCheckpointRP, 0);
+
+ final ListState<byte[]> bucketStateContainer = new
MockListState<>();
+ final ListState<Long> partCounterContainer = new
MockListState<>();
+
+ buckets.onElement("test1", new TestUtils.MockSinkContext(null,
1L, 2L));
+ buckets.snapshotState(0L, bucketStateContainer,
partCounterContainer);
+
+ buckets.onElement("test2", new TestUtils.MockSinkContext(null,
1L, 2L));
+ buckets.snapshotState(1L, bucketStateContainer,
partCounterContainer);
+
+ Buckets<String, String> restoredBuckets =
+ restoreBuckets(path, onCheckpointRP, 0,
bucketStateContainer, partCounterContainer);
+
+ final Map<String, Bucket<String, String>> activeBuckets =
restoredBuckets.getActiveBuckets();
+ Assert.assertEquals(2L, activeBuckets.size());
+ Assert.assertTrue(activeBuckets.keySet().contains("test1"));
Review comment:
as I understand, the check logic for test1/2 is the same, it could be
deduped in helper method
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> More tests to increase StreamingFileSink test coverage
> ------------------------------------------------------
>
> Key: FLINK-10097
> URL: https://issues.apache.org/jira/browse/FLINK-10097
> Project: Flink
> Issue Type: Sub-task
> Components: filesystem-connector
> Affects Versions: 1.6.0
> Reporter: Kostas Kloudas
> Assignee: Kostas Kloudas
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.6.3
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)