Skip to content

Commit 31eb8c1

Browse files
authored
fix integration test flake (#145)
1 parent ec204bc commit 31eb8c1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

platform/jvm/capture/src/test/kotlin/io/bitdrift/capture/CaptureLoggerTest.kt

+8-2
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,16 @@ class CaptureLoggerTest {
314314
val sdkConfigured = CaptureTestJniLibrary.nextUploadedLog()
315315
assertThat(sdkConfigured.message).isEqualTo("SDKConfigured")
316316

317-
val log = CaptureTestJniLibrary.nextUploadedLog()
317+
var log = CaptureTestJniLibrary.nextUploadedLog()
318+
319+
// Sometimes a resource log is sent before the actual log, so skip it to make the tests more
320+
// stable.
321+
if (log.fields.containsKey("_battery_val")) {
322+
log = CaptureTestJniLibrary.nextUploadedLog()
323+
}
318324
assertThat(log.level).isEqualTo(LogLevel.DEBUG.value)
319-
assertThat(log.message).isEqualTo("test log")
320325
assertThat(log.fields).isEqualTo(expectedFields)
326+
assertThat(log.message).isEqualTo("test log")
321327
assertThat(log.sessionId).isEqualTo("SESSION_ID")
322328
assertThat(log.rfc3339Timestamp).isEqualTo("2022-07-05T18:55:58.123Z")
323329
}

0 commit comments

Comments
 (0)