Fix backup instrumentation tests.

This commit is contained in:
Cody Henthorne
2025-08-07 12:50:49 -04:00
committed by Greyson Parrelli
parent 2ced30b557
commit 8e6664f41c
2 changed files with 2 additions and 9 deletions

View File

@@ -9,9 +9,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry
import com.github.difflib.DiffUtils import com.github.difflib.DiffUtils
import com.github.difflib.UnifiedDiffUtils import com.github.difflib.UnifiedDiffUtils
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkObject
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
@@ -26,7 +23,6 @@ import org.thoughtcrime.securesms.backup.v2.proto.Frame
import org.thoughtcrime.securesms.backup.v2.stream.PlainTextBackupReader import org.thoughtcrime.securesms.backup.v2.stream.PlainTextBackupReader
import org.thoughtcrime.securesms.database.KeyValueDatabase import org.thoughtcrime.securesms.database.KeyValueDatabase
import org.thoughtcrime.securesms.dependencies.AppDependencies import org.thoughtcrime.securesms.dependencies.AppDependencies
import org.thoughtcrime.securesms.keyvalue.InternalValues
import org.thoughtcrime.securesms.keyvalue.SignalStore import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.whispersystems.signalservice.api.push.ServiceId import org.whispersystems.signalservice.api.push.ServiceId
import java.io.ByteArrayInputStream import java.io.ByteArrayInputStream
@@ -48,10 +44,6 @@ class ArchiveImportExportTests {
@Before @Before
fun setup() { fun setup() {
AppDependencies.jobManager.shutdown() AppDependencies.jobManager.shutdown()
mockkObject(SignalStore)
every { SignalStore.internal } returns mockk<InternalValues>(relaxed = true) {
every { includeDebuglogInBackup } returns false
}
} }
@Test @Test

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.keyvalue
import org.signal.ringrtc.CallManager.DataMode import org.signal.ringrtc.CallManager.DataMode
import org.thoughtcrime.securesms.BuildConfig import org.thoughtcrime.securesms.BuildConfig
import org.thoughtcrime.securesms.backup.v2.proto.BackupDebugInfo import org.thoughtcrime.securesms.backup.v2.proto.BackupDebugInfo
import org.thoughtcrime.securesms.util.Environment
import org.thoughtcrime.securesms.util.Environment.Calling.defaultSfuUrl import org.thoughtcrime.securesms.util.Environment.Calling.defaultSfuUrl
import org.thoughtcrime.securesms.util.RemoteConfig import org.thoughtcrime.securesms.util.RemoteConfig
@@ -185,7 +186,7 @@ class InternalValues internal constructor(store: KeyValueStore) : SignalStoreVal
var showArchiveStateHint by booleanValue(SHOW_ARCHIVE_STATE_HINT, false).defaultForExternalUsers() var showArchiveStateHint by booleanValue(SHOW_ARCHIVE_STATE_HINT, false).defaultForExternalUsers()
/** Whether or not we should include a debuglog in the backup debug info when generating a backup. */ /** Whether or not we should include a debuglog in the backup debug info when generating a backup. */
var includeDebuglogInBackup by booleanValue(INCLUDE_DEBUGLOG_IN_BACKUP, true).falseForExternalUsers() var includeDebuglogInBackup by booleanValue(INCLUDE_DEBUGLOG_IN_BACKUP, !Environment.IS_INSTRUMENTATION).falseForExternalUsers()
/** Any [BackupDebugInfo] that was imported during the last backup restore, if any. */ /** Any [BackupDebugInfo] that was imported during the last backup restore, if any. */
var importedBackupDebugInfo: BackupDebugInfo? by protoValue(IMPORTED_BACKUP_DEBUG_INFO, BackupDebugInfo.ADAPTER).defaultForExternalUsers() var importedBackupDebugInfo: BackupDebugInfo? by protoValue(IMPORTED_BACKUP_DEBUG_INFO, BackupDebugInfo.ADAPTER).defaultForExternalUsers()