Skip to content

Commit fadbed5

Browse files
authored
Fix test to verify native feature disabled (#3132)
## Goal Verify with a config that explicitly disables the native feature instead of relying on the default, which changed. Also changed the logic to be deterministic. <!-- Describe how this change has been tested -->
1 parent e33979b commit fadbed5

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/features/NativeCrashFeatureTest.kt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ internal class NativeCrashFeatureTest {
5858
),
5959
symbols = createNativeSymbolsForCurrentArch(fakeSymbols)
6060
)
61+
62+
private val disabledConfig = FakeInstrumentedConfig(
63+
enabledFeatures = FakeEnabledFeatureConfig(
64+
nativeCrashCapture = false,
65+
stateCaptureEnabled = true
66+
)
67+
)
68+
6169
private val sessionMetadata = StoredTelemetryMetadata(
6270
timestamp = BASE_TIME_MS,
6371
uuid = "30690ad1-6b87-4e08-b72c-7deca14451d8",
@@ -234,17 +242,23 @@ internal class NativeCrashFeatureTest {
234242
}
235243

236244
@Test
237-
fun `stored native crash not sent if ndk disabled`() {
245+
fun `native crash tombstone not processed and sent if ndk disabled`() {
238246
testRule.runTest(
239-
instrumentedConfig = FakeInstrumentedConfig(),
247+
instrumentedConfig = disabledConfig,
240248
setupAction = {
241249
setupCachedDataFromNativeCrash(crashData = crashData)
242250
setupFakeNativeCrash(serializer, crashData)
243251
},
244-
testCaseAction = {},
252+
testCaseAction = {
253+
recordSession {
254+
embrace.logInfo("test")
255+
}
256+
},
245257
assertAction = {
246-
assertEquals(0, getSessionEnvelopes(0).size)
247-
assertEquals(0, getLogEnvelopes(0).size)
258+
// This means the new and resurrected session as well as an Embrace log were delivered.
259+
// Before a native crash log, which would've been delivered if processed.
260+
assertEquals(2, getSessionEnvelopes(2).size)
261+
assertNotNull(getSingleLogEnvelope().getLogOfType(EmbType.System.Log))
248262
}
249263
)
250264
}

0 commit comments

Comments
 (0)