Skip to content

Commit 8916c15

Browse files
committed
Remove --block
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
1 parent 8816603 commit 8916c15

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed

src/main/java/com/datasqrl/FlinkMain.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ public static class SqlRunner implements Callable<Void> {
4949
description = "SQL file to execute.")
5050
private String sqlFile;
5151

52-
@Option(
53-
names = {"--block"},
54-
description = "Wait for the flink job manager to exit.",
55-
defaultValue = "false")
56-
private boolean block;
57-
5852
@Option(
5953
names = {"--planfile"},
6054
description = "Compiled plan JSON file.")
@@ -80,7 +74,6 @@ public Void call() throws Exception {
8074
private final String planFile;
8175
private final String configDir;
8276
private final String udfPath;
83-
private final boolean block;
8477

8578
public static void main(String[] args) throws Exception {
8679
System.out.printf("\n\nExecuting flink-jar-runner: %s\n\n", Arrays.toString(args));
@@ -94,8 +87,7 @@ public static void main(String[] args) throws Exception {
9487
runner.udfPath = System.getenv("UDF_PATH");
9588
}
9689

97-
new FlinkMain(runner.sqlFile, runner.planFile, runner.configDir, runner.udfPath, runner.block)
98-
.run();
90+
new FlinkMain(runner.sqlFile, runner.planFile, runner.configDir, runner.udfPath).run();
9991
System.out.println("Finished flink-jar-runner");
10092
}
10193

@@ -148,10 +140,6 @@ public int run() throws Exception {
148140
return 1;
149141
}
150142

151-
if (block) {
152-
tableResult.await();
153-
}
154-
155143
return 0;
156144
}
157145

src/test/java/com/datasqrl/FlinkMainIT.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
1919
import static org.assertj.core.api.Assertions.assertThatNoException;
20-
import static org.assertj.core.api.Assumptions.assumeThat;
2120

2221
import com.nextbreakpoint.flinkclient.model.JarRunResponseBody;
2322
import com.nextbreakpoint.flinkclient.model.JarUploadResponseBody;
@@ -40,16 +39,13 @@ class FlinkMainIT extends AbstractITSupport {
4039
static Stream<Arguments> sqlScripts() {
4140
var scripts = List.of("flink.sql", "test_sql.sql");
4241
var config = List.of(true, false);
43-
var block = List.of(true, false);
44-
return Lists.cartesianProduct(scripts, config, block).stream()
42+
return Lists.cartesianProduct(scripts, config).stream()
4543
.map(pair -> Arguments.of(pair.toArray()));
4644
}
4745

48-
@ParameterizedTest(name = "{0} {1} {2}")
46+
@ParameterizedTest(name = "{0} {1}")
4947
@MethodSource("sqlScripts")
50-
void givenSqlScript_whenExecuting_thenSuccess(String filename, boolean config, boolean block) {
51-
assumeThat(block).as("`--block` doesn't seem to work").isFalse();
52-
48+
void givenSqlScript_whenExecuting_thenSuccess(String filename, boolean config) {
5349
String sqlFile = "/opt/flink/usrlib/sql/" + filename;
5450
var args = new ArrayList<String>();
5551
args.add("--sqlfile");
@@ -58,17 +54,28 @@ void givenSqlScript_whenExecuting_thenSuccess(String filename, boolean config, b
5854
args.add("--config-dir");
5955
args.add("/opt/flink/usrlib/config/");
6056
}
61-
if (block) {
62-
args.add("--block");
63-
}
6457
execute(args.toArray(String[]::new));
6558
}
6659

60+
static Stream<Arguments> planScripts() {
61+
var scripts = List.of("compiled-plan.json", "test_plan.json");
62+
var config = List.of(true, false);
63+
return Lists.cartesianProduct(scripts, config).stream()
64+
.map(pair -> Arguments.of(pair.toArray()));
65+
}
66+
6767
@ParameterizedTest(name = "{0}")
68-
@CsvSource({"compiled-plan.json", "test_plan.json"})
69-
void givenPlansScript_whenExecuting_thenSuccess(String filename) {
68+
@MethodSource("planScripts")
69+
void givenPlansScript_whenExecuting_thenSuccess(String filename, boolean config) {
7070
String planFile = "/opt/flink/usrlib/plans/" + filename;
71-
execute("--planfile", planFile);
71+
var args = new ArrayList<String>();
72+
args.add("--planfile");
73+
args.add(planFile);
74+
if (config) {
75+
args.add("--config-dir");
76+
args.add("/opt/flink/usrlib/config/");
77+
}
78+
execute(args.toArray(String[]::new));
7279
}
7380

7481
@SneakyThrows

src/test/java/com/datasqrl/SqlRunnerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void setUp() throws URISyntaxException {
4949
@Test
5050
void testCommandLineInvocationWithSqlFile() {
5151
// Simulating passing command-line arguments using picocli
52-
String[] args = {"-s", sqlFile.getAbsolutePath(), "--block"};
52+
String[] args = {"-s", sqlFile.getAbsolutePath()};
5353

5454
// Use CommandLine to parse and execute
5555
CommandLine cmd = new CommandLine(new FlinkMain.SqlRunner());

0 commit comments

Comments
 (0)