From 2c7eb3b9e610dbfc4f651024343a5ff1b3147996 Mon Sep 17 00:00:00 2001 From: Eugene Krivobokov Date: Mon, 6 Jul 2020 11:40:09 +0300 Subject: [PATCH] MBS-8654 Remove rerun on target branch leftovers (#485) --- docs/content/docs/test/Runner.md | 1 - .../kotlin/com/avito/utils/gradle/EnvArgs.kt | 5 -- .../FakeTargetConfiguration.kt | 9 --- .../suite/filter/FakeFilterFactory.kt | 13 +--- .../target/TargetConfiguration.kt | 13 ---- .../instrumentation/executing/TestExecutor.kt | 19 +---- .../InstrumentationTestActionFinalizer.kt | 8 +- .../InstrumentationTestsScheduler.kt | 27 ++++--- .../scheduling/TestsScheduler.kt | 5 +- .../suite/TestSuiteProvider.kt | 15 +--- .../suite/filter/FilterFactoryImpl.kt | 15 +--- ...strumentationTestsActionIntegrationTest.kt | 2 - .../suite/TestSuiteProviderTest.kt | 32 ++------ .../suite/filter/FilterFactoryImplTest.kt | 78 +++++++++---------- 14 files changed, 76 insertions(+), 166 deletions(-) diff --git a/docs/content/docs/test/Runner.md b/docs/content/docs/test/Runner.md index 83cdc30a6c..16ceeaaa37 100644 --- a/docs/content/docs/test/Runner.md +++ b/docs/content/docs/test/Runner.md @@ -670,7 +670,6 @@ import com.avito.instrumentation.reservation.request.Device.LocalEmulator instrumentation { configurations { local { - tryToReRunOnTargetBranch = false targets { api28 { deviceName = "API28" diff --git a/subprojects/gradle/build-environment/src/main/kotlin/com/avito/utils/gradle/EnvArgs.kt b/subprojects/gradle/build-environment/src/main/kotlin/com/avito/utils/gradle/EnvArgs.kt index 67b3a88d9c..a0c6a3aa56 100644 --- a/subprojects/gradle/build-environment/src/main/kotlin/com/avito/utils/gradle/EnvArgs.kt +++ b/subprojects/gradle/build-environment/src/main/kotlin/com/avito/utils/gradle/EnvArgs.kt @@ -52,17 +52,12 @@ interface EnvArgs { } - val isRerunDisabled: Boolean - val build: Build class Impl(project: Project) : EnvArgs, Serializable { override val build: Build - override val isRerunDisabled: Boolean = - project.getBooleanProperty("avito.tests.disableRerunOnTargetBranch", default = false) - init { // todo make local by default? build = when (project.getOptionalStringProperty("avito.build", "teamcity")) { diff --git a/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/FakeTargetConfiguration.kt b/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/FakeTargetConfiguration.kt index 84cdb6a6c0..4cb3ccf127 100644 --- a/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/FakeTargetConfiguration.kt +++ b/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/FakeTargetConfiguration.kt @@ -21,15 +21,6 @@ fun TargetConfiguration.Data.Companion.createStubInstance( minimumFailedCount = 0 ) ), - rerunReservation = Reservation.StaticReservation( - device = Device.CloudEmulator.createStubInstance(), - count = 24, - quota = QuotaConfiguration.Data( - retryCount = 0, - minimumSuccessCount = 1, - minimumFailedCount = 0 - ) - ), deviceName = deviceName, instrumentationParams = instrumentationParams ) diff --git a/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/suite/filter/FakeFilterFactory.kt b/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/suite/filter/FakeFilterFactory.kt index 91bc15f7d8..dbb6c5c281 100644 --- a/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/suite/filter/FakeFilterFactory.kt +++ b/subprojects/gradle/instrumentation-tests-test-fixtures/src/main/kotlin/com/avito/instrumentation/suite/filter/FakeFilterFactory.kt @@ -19,15 +19,10 @@ fun excludedFilter(reason: TestsFilter.Result.Excluded): TestsFilter { } class FakeFilterFactory( - private val initialFilter: TestsFilter = includeAll, - private val rerunFilter: TestsFilter = includeAll + private val filter: TestsFilter = includeAll ) : FilterFactory { - override fun createInitialFilter(): TestsFilter { - return initialFilter + override fun createFilter(): TestsFilter { + return filter } - - override fun createRerunFilter(): TestsFilter { - return rerunFilter - } -} \ No newline at end of file +} diff --git a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/configuration/target/TargetConfiguration.kt b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/configuration/target/TargetConfiguration.kt index e6f238bc3c..275d2af6f9 100644 --- a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/configuration/target/TargetConfiguration.kt +++ b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/configuration/target/TargetConfiguration.kt @@ -9,7 +9,6 @@ import java.io.Serializable open class TargetConfiguration(val name: String) : Serializable { lateinit var scheduling: SchedulingConfiguration - var rerunScheduling: SchedulingConfiguration? = null lateinit var deviceName: String @@ -31,21 +30,11 @@ open class TargetConfiguration(val name: String) : Serializable { } } - fun rerunScheduling(closure: Closure) { - rerunScheduling = SchedulingConfiguration() - .let { - closure.delegate = it - closure.call() - it - } - } - fun data(parentInstrumentationParameters: InstrumentationParameters): Data { return Data( name = name, reservation = scheduling.data().reservation, - rerunReservation = rerunScheduling?.data()?.reservation ?: scheduling.data().reservation, deviceName = deviceName, instrumentationParams = parentInstrumentationParameters .applyParameters(instrumentationParams) @@ -57,14 +46,12 @@ open class TargetConfiguration(val name: String) : Serializable { fun validate() { scheduling.validate() - rerunScheduling?.validate() require(deviceName.isNotBlank()) { "deviceName must be set" } } data class Data( val name: String, val reservation: Reservation, - val rerunReservation: Reservation, val deviceName: String, val instrumentationParams: InstrumentationParameters ) : Serializable { diff --git a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/executing/TestExecutor.kt b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/executing/TestExecutor.kt index 127f61f3da..e63d6451bd 100644 --- a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/executing/TestExecutor.kt +++ b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/executing/TestExecutor.kt @@ -33,12 +33,7 @@ interface TestExecutor { logcatDir: File ) - sealed class RunType { - abstract val id: String - - data class Run(override val id: String) : RunType() - data class Rerun(override val id: String) : RunType() - } + data class RunType(val id: String) class Impl( private val logger: CILogger, @@ -66,7 +61,6 @@ interface TestExecutor { executionParameters = executionParameters ) val reservations = reservations( - runType, testsToRun, configurationName = configuration.name ) @@ -77,10 +71,7 @@ interface TestExecutor { ) { devices -> val testRequests = testsToRun .map { targetTestRun -> - val reservation = when (runType) { - is RunType.Run -> targetTestRun.target.reservation - is RunType.Rerun -> targetTestRun.target.rerunReservation - } + val reservation = targetTestRun.target.reservation val quota = reservation.quota @@ -140,7 +131,6 @@ interface TestExecutor { ).apply { mkdirs() } private fun reservations( - runType: RunType, tests: List, configurationName: String ): Collection { @@ -148,10 +138,7 @@ interface TestExecutor { val testsGroupedByTargets: Map> = tests.groupBy { TargetGroup( name = it.target.name, - reservation = when (runType) { - is RunType.Run -> it.target.reservation - is RunType.Rerun -> it.target.rerunReservation - } + reservation = it.target.reservation ) } diff --git a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/finalizer/InstrumentationTestActionFinalizer.kt b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/finalizer/InstrumentationTestActionFinalizer.kt index 1a018abaf6..491819fb03 100644 --- a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/finalizer/InstrumentationTestActionFinalizer.kt +++ b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/finalizer/InstrumentationTestActionFinalizer.kt @@ -41,13 +41,13 @@ interface InstrumentationTestActionFinalizer { testsExecutionResults: TestsScheduler.Result ) { val testRunResult = TestRunResult( - reportedTests = testsExecutionResults.initialTestsResult.getOrElse { emptyList() }, + reportedTests = testsExecutionResults.testsResult.getOrElse { emptyList() }, failed = hasFailedTestDeterminer.determine( - runResult = testsExecutionResults.testResultsAfterBranchReruns + runResult = testsExecutionResults.testsResult ), notReported = hasNotReportedTestsDeterminer.determine( - runResult = testsExecutionResults.initialTestsResult, - allTests = testsExecutionResults.initialTestSuite.testsToRun.map { it.test } + runResult = testsExecutionResults.testsResult, + allTests = testsExecutionResults.testSuite.testsToRun.map { it.test } ) ) diff --git a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/InstrumentationTestsScheduler.kt b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/InstrumentationTestsScheduler.kt index 9d7db0edeb..f035027423 100644 --- a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/InstrumentationTestsScheduler.kt +++ b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/InstrumentationTestsScheduler.kt @@ -30,36 +30,35 @@ class InstrumentationTestsScheduler( val flakyTestInfo = FlakyTestInfo() - val initialTestSuite = testSuiteProvider.getInitialTestSuite( + val testSuite = testSuiteProvider.getTestSuite( tests = testSuiteLoader.loadTestSuite(params.testApk, AllChecks()) ) - filterInfoWriter.writeAppliedFilter(initialTestSuite.appliedFilter) - filterInfoWriter.writeFilterExcludes(initialTestSuite.skippedTests) + filterInfoWriter.writeAppliedFilter(testSuite.appliedFilter) + filterInfoWriter.writeFilterExcludes(testSuite.skippedTests) - writeInitialTestSuite(initialTestSuite) + writeTestSuite(testSuite) - val initialTestsResult = testsRunner.runTests( + val testsResult = testsRunner.runTests( mainApk = params.mainApk, testApk = params.testApk, - runType = TestExecutor.RunType.Run(id = "initialRun"), + runType = TestExecutor.RunType(id = "initialRun"), reportCoordinates = reportCoordinates, report = sourceReport, - testsToRun = initialTestSuite.testsToRun + testsToRun = testSuite.testsToRun ) - flakyTestInfo.addReport(initialTestsResult) + flakyTestInfo.addReport(testsResult) return TestsScheduler.Result( - initialTestSuite = initialTestSuite, - initialTestsResult = initialTestsResult, - testResultsAfterBranchReruns = initialTestsResult, + testSuite = testSuite, + testsResult = testsResult, flakyInfo = flakyTestInfo.getInfo() ) } - private fun writeInitialTestSuite(initialTestSuite: TestSuiteProvider.TestSuite) { - File(params.outputDir, "initial-suite.json") - .writeText(gson.toJson(initialTestSuite.testsToRun.map { it.test })) + private fun writeTestSuite(testSuite: TestSuiteProvider.TestSuite) { + File(params.outputDir, "test-suite.json") + .writeText(gson.toJson(testSuite.testsToRun.map { it.test })) } } diff --git a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/TestsScheduler.kt b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/TestsScheduler.kt index 94ba71d106..d76b464b75 100644 --- a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/TestsScheduler.kt +++ b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/scheduling/TestsScheduler.kt @@ -10,9 +10,8 @@ interface TestsScheduler { fun schedule(): Result data class Result( - val initialTestSuite: TestSuiteProvider.TestSuite, - val initialTestsResult: Try>, - val testResultsAfterBranchReruns: Try>, + val testSuite: TestSuiteProvider.TestSuite, + val testsResult: Try>, val flakyInfo: List ) } diff --git a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/TestSuiteProvider.kt b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/TestSuiteProvider.kt index 265cf74ede..f216539a53 100644 --- a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/TestSuiteProvider.kt +++ b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/TestSuiteProvider.kt @@ -21,8 +21,7 @@ interface TestSuiteProvider { val skippedTests: List> ) - fun getInitialTestSuite(tests: List): TestSuite - fun getRerunTestsSuite(tests: List): TestSuite + fun getTestSuite(tests: List): TestSuite class Impl( private val report: Report, @@ -31,14 +30,13 @@ interface TestSuiteProvider { private val filterFactory: FilterFactory ) : TestSuiteProvider { - - override fun getInitialTestSuite( + override fun getTestSuite( tests: List ): TestSuite { val suite = getTestSuite( tests = tests, - filter = filterFactory.createInitialFilter() + filter = filterFactory.createFilter() ) if (reportSkippedTests) { @@ -62,13 +60,6 @@ interface TestSuiteProvider { return suite } - override fun getRerunTestsSuite( - tests: List - ): TestSuite = getTestSuite( - tests = tests, - filter = filterFactory.createRerunFilter() - ) - private fun getTestSuite( tests: List, filter: TestsFilter diff --git a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImpl.kt b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImpl.kt index 3dc9ff3f65..1679e6921c 100644 --- a/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImpl.kt +++ b/subprojects/gradle/instrumentation-tests/src/main/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImpl.kt @@ -8,11 +8,10 @@ import com.avito.report.model.SimpleRunTest import java.io.File interface FilterFactory { - fun createInitialFilter(): TestsFilter - fun createRerunFilter(): TestsFilter + fun createFilter(): TestsFilter companion object { - internal val JUNIT_IGNORE_ANNOTATION = "org.junit.Ignore" + internal const val JUNIT_IGNORE_ANNOTATION = "org.junit.Ignore" fun create( filterData: InstrumentationFilter.Data, @@ -37,7 +36,7 @@ private class FilterFactoryImpl( private val reportConfig: Report.Factory.Config ) : FilterFactory { - override fun createInitialFilter(): TestsFilter { + override fun createFilter(): TestsFilter { val filters = mutableListOf() filters.add(ExcludeBySdkFilter()) filters.addAnnotationFilters() @@ -50,14 +49,6 @@ private class FilterFactoryImpl( ) } - override fun createRerunFilter(): TestsFilter { - val filters = mutableListOf() - filters.addSourcePreviousSignatureFilters() - return CompositionFilter( - filters - ) - } - private fun MutableList.addAnnotationFilters() { if (filterData.fromSource.annotations.included.isNotEmpty()) { add( diff --git a/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/InstrumentationTestsActionIntegrationTest.kt b/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/InstrumentationTestsActionIntegrationTest.kt index 3d0cd1e4bc..554d836641 100644 --- a/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/InstrumentationTestsActionIntegrationTest.kt +++ b/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/InstrumentationTestsActionIntegrationTest.kt @@ -42,8 +42,6 @@ internal class InstrumentationTestsActionIntegrationTest { private val reportsApi = FakeReportsApi() private val testSuiteLoader = FakeTestSuiteLoader() private val reportCoordinates = ReportCoordinates.createStubInstance() - private val targetReportCoordinates = - reportCoordinates.copy(jobSlug = reportCoordinates.jobSlug + "-rerun") private val testRunner = FakeTestExecutor() private val testExecutorFactory = object : TestExecutorFactory { override fun createExecutor( diff --git a/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/TestSuiteProviderTest.kt b/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/TestSuiteProviderTest.kt index 31960d9949..18e5594dbf 100644 --- a/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/TestSuiteProviderTest.kt +++ b/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/TestSuiteProviderTest.kt @@ -22,10 +22,10 @@ internal class TestSuiteProviderTest { ) @Test - fun `initial suite - dont skip tests - if rerun enabled, but results unavailable`() { + fun `test suite - dont skip tests`() { val testSuiteProvider = createTestSuiteProvider() - val result = testSuiteProvider.getInitialTestSuite( + val result = testSuiteProvider.getTestSuite( tests = listOf(simpleTestInApk) ) @@ -33,35 +33,13 @@ internal class TestSuiteProviderTest { } @Test - fun `initial suite - dont skip tests - if rerun enabled, but report is empty`() { - val testSuiteProvider = createTestSuiteProvider() - - val result = testSuiteProvider.getInitialTestSuite( - tests = listOf(simpleTestInApk) - ) - - assertThat(result.testsToRun.map { it.test.name }).containsExactly(simpleTestInApk.testName) - } - - @Test - fun `initial suite - dont skip tests - if rerun enabled, but previous report does not contain specific test`() { - val testSuiteProvider = createTestSuiteProvider() - - val result = testSuiteProvider.getInitialTestSuite( - tests = listOf(simpleTestInApk) - ) - - assertThat(result.testsToRun.map { it.test.name }).containsExactly(simpleTestInApk.testName) - } - - @Test - fun `initial suite - skip test - if rerun enabled and test passed in previous run`() { + fun `test suite - skip test - if rerun enabled and test passed in previous run`() { val report = FakeReport() val testSuiteProvider = createTestSuiteProvider( report = report, reportSkippedTests = true, filterFactory = FakeFilterFactory( - initialFilter = excludedFilter( + filter = excludedFilter( TestsFilter.Result.Excluded.MatchExcludeSignature( name = "", source = TestsFilter.Signatures.Source.PreviousRun @@ -70,7 +48,7 @@ internal class TestSuiteProviderTest { ) ) - testSuiteProvider.getInitialTestSuite( + testSuiteProvider.getTestSuite( tests = listOf(simpleTestInApk) ) diff --git a/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImplTest.kt b/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImplTest.kt index 3873adcb7a..2de2e7c756 100644 --- a/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImplTest.kt +++ b/subprojects/gradle/instrumentation-tests/src/test/kotlin/com/avito/instrumentation/suite/filter/FilterFactoryImplTest.kt @@ -13,7 +13,7 @@ import com.avito.report.model.ReportCoordinates import com.avito.report.model.SimpleRunTest import com.avito.report.model.Status import com.avito.report.model.createStubInstance -import com.google.common.truth.Truth +import com.google.common.truth.Truth.assertThat import org.funktionale.tries.Try import org.junit.Test import java.io.File @@ -21,14 +21,14 @@ import java.io.File internal class FilterFactoryImplTest { @Test - fun `when filterData is empty then initial filters always contains ExcludedBySdk and ExcludeAnnotationFilter`() { + fun `when filterData is empty then filters always contains ExcludedBySdk and ExcludeAnnotationFilter`() { val factory = createFilterFactory( filter = InstrumentationFilter.Data.createStub() ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - Truth.assertThat(initialFilter.filters) + assertThat(filter.filters) .containsExactly( ExcludeBySdkFilter(), ExcludeAnnotationsFilter(setOf(FilterFactory.JUNIT_IGNORE_ANNOTATION)) @@ -36,7 +36,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData contains included annotations then initial filters have IncludeAnnotationFilter`() { + fun `when filterData contains included annotations then filters have IncludeAnnotationFilter`() { val annotation = "Annotation" val factory = createFilterFactory( filter = InstrumentationFilter.Data.createStub( @@ -47,14 +47,14 @@ internal class FilterFactoryImplTest { ) ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - Truth.assertThat(initialFilter.filters) + assertThat(filter.filters) .containsAtLeastElementsIn(listOf(IncludeAnnotationsFilter(setOf(annotation)))) } @Test - fun `when filterData contains prefixes then initial filters have IncludeBySignatures, ExcludeBySignatures`() { + fun `when filterData contains prefixes then filters have IncludeBySignatures, ExcludeBySignatures`() { val includedPrefix = "included_prefix" val excludedPrefix = "excluded_prefix" val factory = createFilterFactory( @@ -66,9 +66,9 @@ internal class FilterFactoryImplTest { ) ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - Truth.assertThat(initialFilter.filters) + assertThat(filter.filters) .containsAtLeastElementsIn( listOf( IncludeByTestSignaturesFilter( @@ -92,7 +92,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData includePrevious statuses and Report return list without that status then initial filters contain IncludeTestSignaturesFilters#Previous with empty signatures`() { + fun `when filterData includePrevious statuses and Report return list without that status then filters contain IncludeTestSignaturesFilters#Previous with empty signatures`() { val factory = createFilterFactory( filter = InstrumentationFilter.Data.createStub( previousStatuses = Filter.Value( @@ -102,9 +102,9 @@ internal class FilterFactoryImplTest { ) ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - val that = Truth.assertThat(initialFilter.filters) + val that = assertThat(filter.filters) that.containsAtLeastElementsIn( listOf( IncludeByTestSignaturesFilter( @@ -116,7 +116,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData includePrevious statuses and Report return list then initial filters contain IncludeTestSignaturesFilters#Previous with included statuses`() { + fun `when filterData includePrevious statuses and Report return list then filters contain IncludeTestSignaturesFilters#Previous with included statuses`() { val report = FakeReport() report.getTestsResult = Try.Success( listOf( @@ -147,9 +147,9 @@ internal class FilterFactoryImplTest { reportConfig = reportConfig ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - val that = Truth.assertThat(initialFilter.filters) + val that = assertThat(filter.filters) that.containsAtLeastElementsIn( listOf( IncludeByTestSignaturesFilter( @@ -166,7 +166,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData excludePrevious statuses and Report return list then initial filters contain ExcludeTestSignaturesFilters#Previous with included statuses`() { + fun `when filterData excludePrevious statuses and Report return list then filters contain ExcludeTestSignaturesFilters#Previous with included statuses`() { val report = FakeReport() report.getTestsResult = Try.Success( listOf( @@ -196,9 +196,9 @@ internal class FilterFactoryImplTest { reportConfig = reportConfig ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - val that = Truth.assertThat(initialFilter.filters) + val that = assertThat(filter.filters) that.containsAtLeastElementsIn( listOf( ExcludeByTestSignaturesFilter( @@ -215,7 +215,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData previousStatuses is empty then initial filters don't contain PreviousRun filters`() { + fun `when filterData previousStatuses is empty then filters don't contain PreviousRun filters`() { val factory = createFilterFactory( filter = InstrumentationFilter.Data.createStub( previousStatuses = Filter.Value( @@ -225,10 +225,10 @@ internal class FilterFactoryImplTest { ) ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - initialFilter.filters.forEach { filter -> - val assert = Truth.assertThat(filter) + filter.filters.forEach { filter -> + val assert = assertThat(filter) assert .isNotInstanceOf(IncludeByTestSignaturesFilter::class.java) assert @@ -237,15 +237,15 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData report is empty then initial filters don't contain Report filters`() { + fun `when filterData report is empty then filters don't contain Report filters`() { val factory = createFilterFactory( filter = InstrumentationFilter.Data.createStub() ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - initialFilter.filters.forEach { filter -> - val assert = Truth.assertThat(filter) + filter.filters.forEach { filter -> + val assert = assertThat(filter) assert .isNotInstanceOf(IncludeByTestSignaturesFilter::class.java) assert @@ -254,7 +254,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData report is present and has includes then initial filters contain Report include filter`() { + fun `when filterData report is present and has includes then filters contain Report include filter`() { val reportId = "reportId" val reportConfig = Report.Factory.Config.ReportViewerId(reportId) val report = FakeReport() @@ -288,9 +288,9 @@ internal class FilterFactoryImplTest { ) ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - Truth.assertThat(initialFilter.filters) + assertThat(filter.filters) .containsAtLeastElementsIn( listOf( IncludeByTestSignaturesFilter( @@ -307,7 +307,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData report is present and has excludes then initial filters contain Report exclude filter`() { + fun `when filterData report is present and has excludes then filters contain Report exclude filter`() { val reportId = "reportId" val reportConfig = Report.Factory.Config.ReportViewerId(reportId) val report = FakeReport() @@ -341,9 +341,9 @@ internal class FilterFactoryImplTest { ) ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - Truth.assertThat(initialFilter.filters) + assertThat(filter.filters) .containsAtLeastElementsIn( listOf( ExcludeByTestSignaturesFilter( @@ -360,7 +360,7 @@ internal class FilterFactoryImplTest { } @Test - fun `when filterData report is present and statuses empty then initial filters don't contain Report filter`() { + fun `when filterData report is present and statuses empty then filters don't contain Report filter`() { val reportId = "reportId" val reportConfig = Report.Factory.Config.ReportViewerId(reportId) val report = FakeReport() @@ -394,10 +394,10 @@ internal class FilterFactoryImplTest { ) ) - val initialFilter = factory.createInitialFilter() as CompositionFilter + val filter = factory.createFilter() as CompositionFilter - initialFilter.filters.forEach { filter -> - val assert = Truth.assertThat(filter) + filter.filters.forEach { filter -> + val assert = assertThat(filter) assert .isNotInstanceOf(IncludeByTestSignaturesFilter::class.java) assert @@ -405,7 +405,7 @@ internal class FilterFactoryImplTest { } } - fun createFilterFactory( + private fun createFilterFactory( filter: InstrumentationFilter.Data, impactAnalysisFile: File? = null, reportsByConfig: Map = emptyMap(), @@ -429,4 +429,4 @@ internal class FilterFactoryImplTest { } ) } -} \ No newline at end of file +}