[
https://issues.apache.org/jira/browse/FLINK-8332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309497#comment-16309497
]
ASF GitHub Bot commented on FLINK-8332:
---------------------------------------
Github user GJL commented on a diff in the pull request:
https://github.com/apache/flink/pull/5219#discussion_r159403066
--- Diff:
flink-clients/src/test/java/org/apache/flink/client/CliFrontendSavepointTest.java
---
@@ -178,65 +185,30 @@ public void testTriggerSavepointCustomTarget() throws
Exception {
public void testDisposeSavepointSuccess() throws Exception {
replaceStdOutAndStdErr();
- try {
- String savepointPath = "expectedSavepointPath";
- ActorGateway jobManager = mock(ActorGateway.class);
+ String savepointPath = "expectedSavepointPath";
- Promise<Object> triggerResponse = new
scala.concurrent.impl.Promise.DefaultPromise<>();
+ final CompletableFuture<Acknowledge> disposeCallFuture = new
CompletableFuture<>();
- when(jobManager.ask(
- Mockito.eq(new
DisposeSavepoint(savepointPath)),
-
any(FiniteDuration.class))).thenReturn(triggerResponse.future());
+ ClusterClient clusterClient = new
DisposeSavepointClusterClient((String path, Time timeout) -> {
+ disposeCallFuture.complete(Acknowledge.get());
+ return
CompletableFuture.completedFuture(Acknowledge.get());
+ });
- triggerResponse.success(getDisposeSavepointSuccess());
+ try {
- CliFrontend frontend = new MockCliFrontend(
- CliFrontendTestUtils.getConfigDir(),
jobManager);
+ CliFrontend frontend = new
MockedCliFrontend(clusterClient);
String[] parameters = { "-d", savepointPath };
- int returnCode = frontend.savepoint(parameters);
+ frontend.savepoint(parameters);
- assertEquals(0, returnCode);
- verify(jobManager, times(1)).ask(
- Mockito.eq(new
DisposeSavepoint(savepointPath)),
- any(FiniteDuration.class));
+ disposeCallFuture.get();
String outMsg = buffer.toString();
assertTrue(outMsg.contains(savepointPath));
assertTrue(outMsg.contains("disposed"));
}
finally {
- restoreStdOutAndStdErr();
- }
- }
-
- /**
- * Tests that a disposal failure due a ClassNotFoundException triggers
a
- * note about the JAR option.
- */
- @Test
- public void testDisposeClassNotFoundException() throws Exception {
--- End diff --
The behaviour moved to `ClusterClient` but we are not testing it anymore.
> Move dispose savepoint into ClusterClient
> -----------------------------------------
>
> Key: FLINK-8332
> URL: https://issues.apache.org/jira/browse/FLINK-8332
> Project: Flink
> Issue Type: Sub-task
> Components: Client
> Affects Versions: 1.5.0
> Reporter: Till Rohrmann
> Assignee: Till Rohrmann
> Labels: flip-6
> Fix For: 1.5.0
>
>
> Currently, the {{CliFrontend}} sends the command for disposing a savepoint.
> In order to better abstract this functionality we should move it to the
> {{ClusterClient}}. That way we can have different implementations of the
> {{ClusterClient}} (Flip-6 and old code) which are used by the same
> {{CliFrontend}}.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)