You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by pn...@apache.org on 2020/03/25 14:07:10 UTC
[flink] 05/11: [hotfix][test] Remove no-op tests for
AbstractStreamOperator
This is an automated email from the ASF dual-hosted git repository.
pnowojski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit a909af142cabe43aad74ed0d5848164c08e81a02
Author: Piotr Nowojski <pi...@gmail.com>
AuthorDate: Tue Mar 10 14:09:08 2020 +0100
[hotfix][test] Remove no-op tests for AbstractStreamOperator
Those two tests were not performing any assertions since [FLINK-13326] (c75af84d44dfb9b883115bf4fd65b6a5989464e4)
---
.../api/operators/AbstractStreamOperatorTest.java | 68 ----------------------
1 file changed, 68 deletions(-)
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
index 93dca8f..a4a0dc2 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
@@ -494,74 +494,6 @@ public class AbstractStreamOperatorTest {
}
/**
- * Checks that the state snapshot context is closed after a successful snapshot operation.
- */
- @Test
- public void testSnapshotMethod() throws Exception {
- final long checkpointId = 42L;
- final long timestamp = 1L;
-
- final CloseableRegistry closeableRegistry = new CloseableRegistry();
-
- StateSnapshotContextSynchronousImpl context = spy(new StateSnapshotContextSynchronousImpl(0L, 0L));
-
- whenNew(StateSnapshotContextSynchronousImpl.class).withAnyArguments().thenReturn(context);
-
- StreamTask<Void, AbstractStreamOperator<Void>> containingTask = mock(StreamTask.class);
- when(containingTask.getCancelables()).thenReturn(closeableRegistry);
-
- AbstractStreamOperator<Void> operator = mock(AbstractStreamOperator.class);
- when(operator.snapshotState(anyLong(), anyLong(), any(CheckpointOptions.class), any(CheckpointStreamFactory.class))).thenCallRealMethod();
- doReturn(containingTask).when(operator).getContainingTask();
-
- operator.snapshotState(
- checkpointId,
- timestamp,
- CheckpointOptions.forCheckpointWithDefaultLocation(),
- new MemCheckpointStreamFactory(Integer.MAX_VALUE));
-
- }
-
- /**
- * Tests that the created StateSnapshotContextSynchronousImpl is closed in case of a failing
- * Operator#snapshotState(StateSnapshotContextSynchronousImpl) call.
- */
- @Test
- public void testFailingSnapshotMethod() throws Exception {
- final long checkpointId = 42L;
- final long timestamp = 1L;
-
- final Exception failingException = new Exception("Test exception");
-
- final CloseableRegistry closeableRegistry = new CloseableRegistry();
-
- StateSnapshotContextSynchronousImpl context = mock(StateSnapshotContextSynchronousImpl.class);
-
- whenNew(StateSnapshotContextSynchronousImpl.class).withAnyArguments().thenReturn(context);
-
- StreamTask<Void, AbstractStreamOperator<Void>> containingTask = mock(StreamTask.class);
- when(containingTask.getCancelables()).thenReturn(closeableRegistry);
-
- AbstractStreamOperator<Void> operator = mock(AbstractStreamOperator.class);
- when(operator.snapshotState(anyLong(), anyLong(), any(CheckpointOptions.class), any(CheckpointStreamFactory.class))).thenCallRealMethod();
- doReturn(containingTask).when(operator).getContainingTask();
-
- // lets fail when calling the actual snapshotState method
- doThrow(failingException).when(operator).snapshotState(eq(context));
-
- try {
- operator.snapshotState(
- checkpointId,
- timestamp,
- CheckpointOptions.forCheckpointWithDefaultLocation(),
- new MemCheckpointStreamFactory(Integer.MAX_VALUE));
- fail("Exception expected.");
- } catch (Exception e) {
- assertEquals(failingException.getMessage(), e.getCause().getMessage());
- }
- }
-
- /**
* Tests that a failing snapshot method call to the keyed state backend will trigger the closing
* of the StateSnapshotContextSynchronousImpl and the cancellation of the
* OperatorSnapshotResult. The latter is supposed to also cancel all assigned futures.