Add recovery during deserialization and upload test artifacts (#243)
* Add recovery during message deserialization, update workflow, use JUnit Platform for JVM tests
This commit is contained in:
parent
b37a0f62d0
commit
a23856e68e
3 changed files with 28 additions and 4 deletions
11
.github/workflows/validate-pr.yml
vendored
11
.github/workflows/validate-pr.yml
vendored
|
|
@ -3,7 +3,7 @@ name: Validate PR
|
|||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
branches: [ main ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
|
@ -15,17 +15,26 @@ jobs:
|
|||
name: Validate PR
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Clean Build with Gradle
|
||||
run: ./gradlew clean build
|
||||
|
||||
- name: Upload JUnit test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: junit-results
|
||||
path: '**/build/test-results/test/*.xml'
|
||||
|
||||
- name: Disable Auto-Merge on Fail
|
||||
if: failure()
|
||||
run: gh pr merge --disable-auto "$PR_URL"
|
||||
|
|
|
|||
|
|
@ -44,7 +44,17 @@ public class ReadBuffer {
|
|||
try {
|
||||
return deserializeMessage(line)
|
||||
} catch (e: Exception) {
|
||||
logger.error(e) { "Failed to deserialize message from line: $line\nSkipping..." }
|
||||
logger.error(e) { "Failed to deserialize message from line: $line\nAttempting to recover..." }
|
||||
// if there is a non-JSON object prefix, try to parse from the first '{' onward.
|
||||
val braceIndex = line.indexOf('{')
|
||||
if (braceIndex != -1) {
|
||||
val trimmed = line.substring(braceIndex)
|
||||
try {
|
||||
return deserializeMessage(trimmed)
|
||||
} catch (ignored: Exception) {
|
||||
logger.error(ignored) { "Deserialization failed for line: $line\nSkipping..." }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ plugins {
|
|||
}
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
testRuns["test"].executionTask.configure {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
commonTest {
|
||||
dependencies {
|
||||
|
|
|
|||
Loading…
Reference in a new issue