Merge pull request #5453 from vector-im/michaelk/cleanups_for_tests

Remove deprecated warning in TestMatrix, and reduce severity of identity server error
This commit is contained in:
Michael Kaye 2022-03-08 14:09:58 +00:00 committed by GitHub
commit 48cf2adcf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 15 deletions

View File

@ -13,7 +13,6 @@ env:
CI_GRADLE_ARG_PROPERTIES: >
-Porg.gradle.jvmargs=-Xmx4g
-Porg.gradle.parallel=false
-PallWarningsAsErrors=false
jobs:
# Build Android Tests [Matrix SDK]
build-android-test-matrix-sdk:
@ -298,7 +297,7 @@ jobs:
touch emulator.log
chmod 777 emulator.log
adb logcat >> emulator.log &
./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest || (adb pull storage/emulated/0/Pictures/failure_screenshots && exit 1 )
./gradlew $CI_GRADLE_ARG_PROPERTIES connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest || (adb pull storage/emulated/0/Pictures/failure_screenshots && exit 1 )
- name: Upload Test Report Log
uses: actions/upload-artifact@v2
if: always()

View File

@ -30,7 +30,7 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Run unit tests
run: ./gradlew clean test $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false --stacktrace
run: ./gradlew clean test $CI_GRADLE_ARG_PROPERTIES --stacktrace
- name: Format unit test results
if: always()
run: python3 ./tools/ci/render_test_output.py unit ./**/build/test-results/**/*.xml

View File

@ -71,7 +71,7 @@ class CommonTestHelper(context: Context) {
)
)
}
matrix = TestMatrix.getInstance(context)
matrix = TestMatrix.getInstance()
}
fun createAccount(userNamePrefix: String, testParams: SessionTestParams): Session {

View File

@ -105,16 +105,9 @@ internal class TestMatrix constructor(context: Context, matrixConfiguration: Mat
}
}
fun getInstance(context: Context): TestMatrix {
if (isInit.compareAndSet(false, true)) {
val appContext = context.applicationContext
if (appContext is MatrixConfiguration.Provider) {
val matrixConfiguration = (appContext as MatrixConfiguration.Provider).providesMatrixConfiguration()
instance = TestMatrix(appContext, matrixConfiguration)
} else {
throw IllegalStateException("Matrix is not initialized properly." +
" You should call Matrix.initialize or let your application implements MatrixConfiguration.Provider.")
}
fun getInstance(): TestMatrix {
if (isInit.compareAndSet(false, false)) {
throw IllegalStateException("Matrix is not initialized properly. You should call TestMatrix.initialize first")
}
return instance
}

View File

@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.session.signout
import org.matrix.android.sdk.api.failure.Failure
import org.matrix.android.sdk.api.failure.MatrixError
import org.matrix.android.sdk.api.session.identity.IdentityServiceError
import org.matrix.android.sdk.internal.network.GlobalErrorReceiver
import org.matrix.android.sdk.internal.network.executeRequest
import org.matrix.android.sdk.internal.session.cleanup.CleanupSession
@ -65,7 +66,13 @@ internal class DefaultSignOutTask @Inject constructor(
// Logout from identity server if any
runCatching { identityDisconnectTask.execute(Unit) }
.onFailure { Timber.w(it, "Unable to disconnect identity server") }
.onFailure {
if (it is IdentityServiceError.NoIdentityServerConfigured) {
Timber.i("No identity server configured to disconnect")
} else {
Timber.w(it, "Unable to disconnect identity server")
}
}
Timber.d("SignOut: cleanup session...")
cleanupSession.cleanup()