Skip to content

Commit

Permalink
chore: fetch logs from the runner
Browse files Browse the repository at this point in the history
Attempt to fix failing tests in CI.
  • Loading branch information
vvagaytsev committed Oct 18, 2022
1 parent 6957022 commit 6211fe8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/plugins/kubernetes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ ${cmd.join(" ")}
version,
}
} catch (err) {
const containerLogs = err.detail.logs
const containerLogs = (await runner.getMainContainerLogsSafe()) || err.message
const exitCode = err.detail.result.exitCode

result = handlePodError({
Expand Down Expand Up @@ -864,7 +864,7 @@ export class PodRunner extends PodRunnerParams {
if (exitCode === 137 || exitReason === "OOMKilled") {
const msg = `Pod container was OOMKilled.`
throw new OutOfMemoryError(msg, {
logs: (await this.getDebugLogs()) || msg,
logs: (await this.getMainContainerLogsSafe()) || msg,
exitCode,
serverPod,
})
Expand Down Expand Up @@ -904,7 +904,7 @@ export class PodRunner extends PodRunnerParams {
if (timeoutSec && elapsed > timeoutSec) {
const msg = `Command timed out after ${timeoutSec} seconds.`
throw new TimeoutError(msg, {
logs: (await this.getDebugLogs()) || msg,
logs: (await this.getMainContainerLogsSafe()) || msg,
serverPod,
})
}
Expand Down Expand Up @@ -997,7 +997,7 @@ export class PodRunner extends PodRunnerParams {
if (result.exitCode === 137) {
const msg = `Pod container was OOMKilled.`
throw new OutOfMemoryError(msg, {
logs: (await this.getDebugLogs()) || msg,
logs: (await this.getMainContainerLogsSafe()) || msg,
result,
execParams: params,
})
Expand Down Expand Up @@ -1036,7 +1036,7 @@ export class PodRunner extends PodRunnerParams {
return allLogs.find((l) => l.containerName === this.getMainContainerName())?.log || ""
}

async getDebugLogs() {
async getMainContainerLogsSafe() {
try {
return (await this.getMainContainerLogs()).trim()
} catch (err) {
Expand Down

0 comments on commit 6211fe8

Please sign in to comment.