Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): prevent null outputContent #1134

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ class JobExecutorLocal implements JobExecutor {
bakeStatus.state = BakeStatus.State.RUNNING
}

if (outputContent) {
bakeStatus.outputContent = outputContent
}
bakeStatus.outputContent = outputContent

if (logsContent) {
bakeStatus.logsContent = logsContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,29 @@ Final output
true | COMBINED_OUTPUT | COMBINED_OUTPUT
false | EXPECTED_OUTPUT | EXPECTED_LOGS
}

void 'job executor handles empty output'() {
def jobRequest = new JobRequest(
tokenizedCommand: ["true"],
jobId: SOME_JOB_ID,
combineStdOutAndErr: false)

@Subject
def jobExecutorLocal = new JobExecutorLocal(
registry: new DefaultRegistry(),
timeoutMinutes: 1)

when:
def jobId = jobExecutorLocal.startJob(jobRequest)
// Give the script time to run + 100 ms fudge factor
sleep(3000)
def bakeStatus = jobExecutorLocal.updateJob(jobId)

then:
bakeStatus != null
bakeStatus.state == BakeStatus.State.COMPLETED
bakeStatus.result == BakeStatus.Result.SUCCESS
bakeStatus.outputContent == ""
bakeStatus.logsContent == "No output from command."
}
}
Loading