ruanwenjun commented on code in PR #1742:
URL: 
https://github.com/apache/incubator-seatunnel/pull/1742#discussion_r857740720


##########
seatunnel-core/seatunnel-core-flink/src/test/java/org/apache/seatunnel/FlinkStarterTest.java:
##########
@@ -31,6 +31,23 @@ public void buildCommands() {
         Assert.assertTrue(flinkExecuteCommand.contains("--config test.conf"));
         Assert.assertTrue(flinkExecuteCommand.contains("-m yarn-cluster"));
         Assert.assertTrue(flinkExecuteCommand.contains("-Dkey1=value1"));
+        
Assert.assertTrue(flinkExecuteCommand.contains("${FLINK_HOME}/bin/flink run"));
+
+        String[] args1 = {"--config", "test.conf", "-m", "yarn-cluster", "-i", 
"key1=value1", "-i", "key2=value2", "--run-mode", "run-application"};
+        flinkExecuteCommand = String.join(" ", new 
FlinkStarter(args1).buildCommands());
+        
Assert.assertTrue(flinkExecuteCommand.contains("${FLINK_HOME}/bin/flink 
run-application"));
+
+        String[] args2 = {"--config", "test.conf", "-m", "yarn-cluster", "-i", 
"key1=value1", "-i", "key2=value2", "--run-mode", "run"};
+        flinkExecuteCommand = String.join(" ", new 
FlinkStarter(args2).buildCommands());
+        
Assert.assertTrue(flinkExecuteCommand.contains("${FLINK_HOME}/bin/flink run"));
+
+        try {
+            String[] args3 = {"--config", "test.conf", "-m", "yarn-cluster", 
"-i", "key1=value1", "-i", "key2=value2", "--run-mode", "run123"};
+            new FlinkStarter(args3);
+        } catch (Exception e) {
+            Assert.assertTrue(e instanceof IllegalArgumentException);
+            Assert.assertEquals("Run mode run123 not supported", 
e.getMessage());
+        }

Review Comment:
   Yes, I just find in the old code may throw exception if user don't set 
`--run-mode`
   ```java
           this.flinkCommandArgs = parseArgs(args);
   
           String mode = flinkCommandArgs.getRunMode();
           switch (mode) {
               case RUN_MODE_RUN:
               case RUN_MODE_APPLICATION:
                   this.runMode = mode;
                   break;
               default:
                   throw new IllegalArgumentException("Run mode " + mode + " 
not supported");
           }
   ```



-- 
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]

Reply via email to