Fix test test and propagate exceptions more

This commit is contained in:
2023-06-28 13:40:25 -05:00
parent 3187706967
commit c38b8ac595
2 changed files with 5 additions and 0 deletions

View File

@ -145,6 +145,7 @@ public class TestScriptProcessStep implements BackendStep
if(testScriptOutput.getException() != null) if(testScriptOutput.getException() != null)
{ {
output.addValue("exception", testScriptOutput.getException()); output.addValue("exception", testScriptOutput.getException());
output.setException(testScriptOutput.getException());
} }
} }
catch(Exception e) catch(Exception e)
@ -153,6 +154,7 @@ public class TestScriptProcessStep implements BackendStep
// is this the kind of exception meant here? or is it more for one thrown by the script execution? or are those the same?? // // is this the kind of exception meant here? or is it more for one thrown by the script execution? or are those the same?? //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
output.addValue("exception", e); output.addValue("exception", e);
output.setException(e);
} }
} }

View File

@ -71,11 +71,14 @@ class TestScriptProcessStepTest extends BaseTest
insertInput.setRecords(List.of(new Script() insertInput.setRecords(List.of(new Script()
.withName("TestScript") .withName("TestScript")
.withScriptTypeId(insertOutput.getRecords().get(0).getValueInteger("id")) .withScriptTypeId(insertOutput.getRecords().get(0).getValueInteger("id"))
.withTableName(TestUtils.TABLE_NAME_SHAPE)
.toQRecord())); .toQRecord()));
insertOutput = new InsertAction().execute(insertInput); insertOutput = new InsertAction().execute(insertInput);
RunBackendStepInput input = new RunBackendStepInput(); RunBackendStepInput input = new RunBackendStepInput();
input.addValue("scriptId", insertOutput.getRecords().get(0).getValueInteger("id")); input.addValue("scriptId", insertOutput.getRecords().get(0).getValueInteger("id"));
TestUtils.insertDefaultShapes(qInstance);
input.addValue("recordPrimaryKeyList", "1");
input.addValue("fileNames", new ArrayList<>(List.of("script.js"))); input.addValue("fileNames", new ArrayList<>(List.of("script.js")));
input.addValue("fileContents:script.js", "logger.log('oh my.')"); input.addValue("fileContents:script.js", "logger.log('oh my.')");