diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bf49a98a..49e78e997 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,7 @@ jobs: test-android: # macos has hardware acceleration. See android-emulator-runner action runs-on: macos-latest + timeout-minutes: 20 strategy: matrix: # api-level 19 is min sdk, but throws errors related to desugaring diff --git a/app/src/androidTest/java/org/schabi/newpipe/local/history/HistoryRecordManagerTest.kt b/app/src/androidTest/java/org/schabi/newpipe/local/history/HistoryRecordManagerTest.kt index 15e88b09e..c32a43b2a 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/local/history/HistoryRecordManagerTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/local/history/HistoryRecordManagerTest.kt @@ -7,13 +7,13 @@ import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test -import org.junit.rules.Timeout import org.schabi.newpipe.database.AppDatabase import org.schabi.newpipe.database.history.model.SearchHistoryEntry import org.schabi.newpipe.testUtil.TestDatabase import org.schabi.newpipe.testUtil.TrampolineSchedulerRule +import java.time.LocalDateTime import java.time.OffsetDateTime -import java.util.concurrent.TimeUnit +import java.time.ZoneOffset class HistoryRecordManagerTest { @@ -23,9 +23,6 @@ class HistoryRecordManagerTest { @get:Rule val trampolineScheduler = TrampolineSchedulerRule() - @get:Rule - val timeout = Timeout(1, TimeUnit.SECONDS) - @Before fun setup() { database = TestDatabase.createReplacingNewPipeDatabase() @@ -54,10 +51,10 @@ class HistoryRecordManagerTest { @Test fun deleteSearchHistory() { val entries = listOf( - SearchHistoryEntry(OffsetDateTime.now(), 0, "A"), - SearchHistoryEntry(OffsetDateTime.now(), 2, "A"), - SearchHistoryEntry(OffsetDateTime.now(), 1, "B"), - SearchHistoryEntry(OffsetDateTime.now(), 0, "B"), + SearchHistoryEntry(time.minusSeconds(1), 0, "A"), + SearchHistoryEntry(time.minusSeconds(2), 2, "A"), + SearchHistoryEntry(time.minusSeconds(3), 1, "B"), + SearchHistoryEntry(time.minusSeconds(4), 0, "B"), ) // make sure all 4 were inserted @@ -86,9 +83,9 @@ class HistoryRecordManagerTest { @Test fun deleteCompleteSearchHistory() { val entries = listOf( - SearchHistoryEntry(OffsetDateTime.now(), 1, "A"), - SearchHistoryEntry(OffsetDateTime.now(), 2, "B"), - SearchHistoryEntry(OffsetDateTime.now(), 0, "C"), + SearchHistoryEntry(time.minusSeconds(1), 1, "A"), + SearchHistoryEntry(time.minusSeconds(2), 2, "B"), + SearchHistoryEntry(time.minusSeconds(3), 0, "C"), ) // make sure all 3 were inserted @@ -142,14 +139,16 @@ class HistoryRecordManagerTest { } companion object { - val RELATED_SEARCHES_ENTRIES = listOf( - SearchHistoryEntry(OffsetDateTime.now().minusSeconds(7), 2, "AC"), - SearchHistoryEntry(OffsetDateTime.now().minusSeconds(6), 0, "ABC"), - SearchHistoryEntry(OffsetDateTime.now().minusSeconds(5), 1, "BA"), - SearchHistoryEntry(OffsetDateTime.now().minusSeconds(4), 3, "A"), - SearchHistoryEntry(OffsetDateTime.now().minusSeconds(2), 0, "B"), - SearchHistoryEntry(OffsetDateTime.now().minusSeconds(3), 2, "AA"), - SearchHistoryEntry(OffsetDateTime.now().minusSeconds(1), 1, "A"), + private val time = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 1, 1), ZoneOffset.UTC) + + private val RELATED_SEARCHES_ENTRIES = listOf( + SearchHistoryEntry(time.minusSeconds(7), 2, "AC"), + SearchHistoryEntry(time.minusSeconds(6), 0, "ABC"), + SearchHistoryEntry(time.minusSeconds(5), 1, "BA"), + SearchHistoryEntry(time.minusSeconds(4), 3, "A"), + SearchHistoryEntry(time.minusSeconds(2), 0, "B"), + SearchHistoryEntry(time.minusSeconds(3), 2, "AA"), + SearchHistoryEntry(time.minusSeconds(1), 1, "A"), ) } } diff --git a/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt b/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt index 249492d8f..c392d8d3d 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt @@ -4,13 +4,11 @@ import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test -import org.junit.rules.Timeout import org.schabi.newpipe.database.AppDatabase import org.schabi.newpipe.database.stream.model.StreamEntity import org.schabi.newpipe.extractor.stream.StreamType import org.schabi.newpipe.testUtil.TestDatabase import org.schabi.newpipe.testUtil.TrampolineSchedulerRule -import java.util.concurrent.TimeUnit class LocalPlaylistManagerTest { @@ -20,9 +18,6 @@ class LocalPlaylistManagerTest { @get:Rule val trampolineScheduler = TrampolineSchedulerRule() - @get:Rule - val timeout = Timeout(1, TimeUnit.SECONDS) - @Before fun setup() { database = TestDatabase.createReplacingNewPipeDatabase()