Myasuka commented on a change in pull request #18918:
URL: https://github.com/apache/flink/pull/18918#discussion_r814569126
##########
File path:
flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendRunTest.java
##########
@@ -134,49 +134,41 @@ public void testRun() throws Exception {
@Test
public void testClaimRestoreModeParsing() throws Exception {
// test configure savepoint with claim mode
- String[] parameters = {
- "-s", "expectedSavepointPath", "-n", "-restoreMode", "claim",
getTestJarPath()
- };
-
- CommandLine commandLine =
- CliFrontendParser.parse(CliFrontendParser.RUN_OPTIONS,
parameters, true);
- ProgramOptions programOptions = ProgramOptions.create(commandLine);
- ExecutionConfigAccessor executionOptions =
- ExecutionConfigAccessor.fromProgramOptions(programOptions,
Collections.emptyList());
-
- SavepointRestoreSettings savepointSettings =
executionOptions.getSavepointRestoreSettings();
- assertTrue(savepointSettings.restoreSavepoint());
- assertEquals(RestoreMode.CLAIM, savepointSettings.getRestoreMode());
- assertEquals("expectedSavepointPath",
savepointSettings.getRestorePath());
- assertTrue(savepointSettings.allowNonRestoredState());
+ testRestoreMode("-rm", "claim", RestoreMode.CLAIM);
}
@Test
public void testLegacyRestoreModeParsing() throws Exception {
// test configure savepoint with claim mode
- String[] parameters = {
- "-s", "expectedSavepointPath", "-n", "-restoreMode", "legacy",
getTestJarPath()
- };
+ testRestoreMode("-rm", "legacy", RestoreMode.LEGACY);
+ }
- CommandLine commandLine =
- CliFrontendParser.parse(CliFrontendParser.RUN_OPTIONS,
parameters, true);
- ProgramOptions programOptions = ProgramOptions.create(commandLine);
- ExecutionConfigAccessor executionOptions =
- ExecutionConfigAccessor.fromProgramOptions(programOptions,
Collections.emptyList());
+ @Test
+ public void testNoClaimRestoreModeParsing() throws Exception {
+ testRestoreMode("-rm", "no_claim", RestoreMode.NO_CLAIM);
+ }
- SavepointRestoreSettings savepointSettings =
executionOptions.getSavepointRestoreSettings();
- assertTrue(savepointSettings.restoreSavepoint());
- assertEquals(RestoreMode.LEGACY, savepointSettings.getRestoreMode());
- assertEquals("expectedSavepointPath",
savepointSettings.getRestorePath());
- assertTrue(savepointSettings.allowNonRestoredState());
+ @Test
+ public void testClaimRestoreModeParsingLongOption() throws Exception {
+ // test configure savepoint with claim mode
+ testRestoreMode("--restoreMode", "claim", RestoreMode.CLAIM);
}
@Test
- public void testNoClaimRestoreModeParsing() throws Exception {
+ public void testLegacyRestoreModeParsingLongOption() throws Exception {
+ // test configure savepoint with claim mode
Review comment:
I think the comment is not right here, we should use `legacy` mode.
##########
File path:
flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendRunTest.java
##########
@@ -134,49 +134,41 @@ public void testRun() throws Exception {
@Test
public void testClaimRestoreModeParsing() throws Exception {
// test configure savepoint with claim mode
- String[] parameters = {
- "-s", "expectedSavepointPath", "-n", "-restoreMode", "claim",
getTestJarPath()
- };
-
- CommandLine commandLine =
- CliFrontendParser.parse(CliFrontendParser.RUN_OPTIONS,
parameters, true);
- ProgramOptions programOptions = ProgramOptions.create(commandLine);
- ExecutionConfigAccessor executionOptions =
- ExecutionConfigAccessor.fromProgramOptions(programOptions,
Collections.emptyList());
-
- SavepointRestoreSettings savepointSettings =
executionOptions.getSavepointRestoreSettings();
- assertTrue(savepointSettings.restoreSavepoint());
- assertEquals(RestoreMode.CLAIM, savepointSettings.getRestoreMode());
- assertEquals("expectedSavepointPath",
savepointSettings.getRestorePath());
- assertTrue(savepointSettings.allowNonRestoredState());
+ testRestoreMode("-rm", "claim", RestoreMode.CLAIM);
}
@Test
public void testLegacyRestoreModeParsing() throws Exception {
// test configure savepoint with claim mode
Review comment:
I think the comment is not right here, we should use `legacy` mode.
##########
File path:
flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendRunTest.java
##########
@@ -134,49 +134,41 @@ public void testRun() throws Exception {
@Test
public void testClaimRestoreModeParsing() throws Exception {
// test configure savepoint with claim mode
- String[] parameters = {
- "-s", "expectedSavepointPath", "-n", "-restoreMode", "claim",
getTestJarPath()
- };
-
- CommandLine commandLine =
- CliFrontendParser.parse(CliFrontendParser.RUN_OPTIONS,
parameters, true);
- ProgramOptions programOptions = ProgramOptions.create(commandLine);
- ExecutionConfigAccessor executionOptions =
- ExecutionConfigAccessor.fromProgramOptions(programOptions,
Collections.emptyList());
-
- SavepointRestoreSettings savepointSettings =
executionOptions.getSavepointRestoreSettings();
- assertTrue(savepointSettings.restoreSavepoint());
- assertEquals(RestoreMode.CLAIM, savepointSettings.getRestoreMode());
- assertEquals("expectedSavepointPath",
savepointSettings.getRestorePath());
- assertTrue(savepointSettings.allowNonRestoredState());
+ testRestoreMode("-rm", "claim", RestoreMode.CLAIM);
}
@Test
public void testLegacyRestoreModeParsing() throws Exception {
// test configure savepoint with claim mode
- String[] parameters = {
- "-s", "expectedSavepointPath", "-n", "-restoreMode", "legacy",
getTestJarPath()
- };
+ testRestoreMode("-rm", "legacy", RestoreMode.LEGACY);
+ }
- CommandLine commandLine =
- CliFrontendParser.parse(CliFrontendParser.RUN_OPTIONS,
parameters, true);
- ProgramOptions programOptions = ProgramOptions.create(commandLine);
- ExecutionConfigAccessor executionOptions =
- ExecutionConfigAccessor.fromProgramOptions(programOptions,
Collections.emptyList());
+ @Test
+ public void testNoClaimRestoreModeParsing() throws Exception {
+ testRestoreMode("-rm", "no_claim", RestoreMode.NO_CLAIM);
+ }
- SavepointRestoreSettings savepointSettings =
executionOptions.getSavepointRestoreSettings();
- assertTrue(savepointSettings.restoreSavepoint());
- assertEquals(RestoreMode.LEGACY, savepointSettings.getRestoreMode());
- assertEquals("expectedSavepointPath",
savepointSettings.getRestorePath());
- assertTrue(savepointSettings.allowNonRestoredState());
+ @Test
+ public void testClaimRestoreModeParsingLongOption() throws Exception {
+ // test configure savepoint with claim mode
+ testRestoreMode("--restoreMode", "claim", RestoreMode.CLAIM);
}
@Test
- public void testNoClaimRestoreModeParsing() throws Exception {
+ public void testLegacyRestoreModeParsingLongOption() throws Exception {
+ // test configure savepoint with claim mode
+ testRestoreMode("--restoreMode", "legacy", RestoreMode.LEGACY);
+ }
+
+ @Test
+ public void testNoClaimRestoreModeParsingLongOption() throws Exception {
+ testRestoreMode("--restoreMode", "no_claim", RestoreMode.NO_CLAIM);
+ }
+
+ private void testRestoreMode(String flag, String arg, RestoreMode
expectedMode)
+ throws Exception {
// test configure savepoint with claim mode
Review comment:
I think the comments is no lonnger useful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]