Exit code is nullable
- Make exit code nullable and only update of execution status can make it a valid integer - Update JDBC create/start task execution queries to have exitCode as `null` values - Update tests to validate/verify the appropirate exit code values for create/start/complete task executions On merge had to add a pause to the TaskLauncherSinkTests to wait for the task to complete successfully Before we assumed that 0 was a satisfactory result meaning it was either running or completed. Now with the null being returned it could be zero or null. So we have to wait for the task to complete.
This commit is contained in:
committed by
Glenn Renfro
parent
7be8b8a105
commit
324abd4e5c
@@ -128,8 +128,8 @@ public class TaskLauncherSinkTests {
|
||||
assertTrue(waitForDBToBePopulated());
|
||||
|
||||
Page<TaskExecution> taskExecutions = taskExplorer.findAll(PageRequest.of(0, 10));
|
||||
TaskExecution te = taskExecutions.iterator().next();
|
||||
assertEquals("Only one row is expected", 1, taskExecutions.getTotalElements());
|
||||
assertTrue(waitForTaskToComplete());
|
||||
assertEquals("return code should be 0", 0, taskExecutions.iterator().next().getExitCode().intValue());
|
||||
}
|
||||
|
||||
@@ -156,6 +156,19 @@ public class TaskLauncherSinkTests {
|
||||
return isDbPopulated;
|
||||
}
|
||||
|
||||
private boolean waitForTaskToComplete() throws Exception {
|
||||
boolean istTaskComplete = false;
|
||||
for (int waitTime = 0; waitTime <= MAX_WAIT_TIME; waitTime += WAIT_INTERVAL) {
|
||||
Thread.sleep(WAIT_INTERVAL);
|
||||
TaskExecution taskExecution = taskExplorer.getTaskExecution(1);
|
||||
if (taskExecution.getExitCode() != null) {
|
||||
istTaskComplete = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return istTaskComplete;
|
||||
}
|
||||
|
||||
private void launchTask(String artifactURL) {
|
||||
|
||||
TaskLaunchRequest request = new TaskLaunchRequest(artifactURL, null,
|
||||
|
||||
Reference in New Issue
Block a user