-
Notifications
You must be signed in to change notification settings - Fork 452
Description
It should be possible to run Gradle integration tests with the K2 analysis enabled.
Notes
- Under the hood, it should use the switch that was introduced in Add the ability to switch between K1 and K2 analysis for testing #3113 (i.e it should run Gradle test projects with that flag). This is to avoid situations where the automated tests pass, but manual testing fails - it should represent real-world scenarios.
- The task
integrationTest
run without any additional parameters or configuration should NOT run tests with the K2 analysis, it should use the stable K1 analysis only. K2 is still experimental and not everything is expected to work reliably, so its testing should be separate from the tests that are expected to be stable. Especially given that K1 integration tests are often flaky and take a lot of time (1h+) as it is. - Not all integration tests are expected to pass with K2 enabled, so the tests should be configurable / selectable without having to configure or ignore it in code. In other words, tests should be selectable via an input parameter.
- It should be possible to run these tests from the command line and via TeamCity.
Proposal
JUnit's ability to run selected tests via command line could be utilized:
./gradlew :dokka-integration-tests:gradle:integrationTest
--tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest
Could also check if org.jetbrains.dokka.experimental.tryK2
was set to true
when the integrationTest
task was run, and pass it into the TestKit runner:
Lines 37 to 45 in 8e5c63d
.withArguments( | |
listOfNotNull( | |
"-Pdokka_it_dokka_version=${System.getenv("DOKKA_VERSION")}", | |
"-Pdokka_it_kotlin_version=${buildVersions.kotlinVersion}", | |
buildVersions.androidGradlePluginVersion?.let { androidVersion -> | |
"-Pdokka_it_android_gradle_plugin_version=$androidVersion" | |
}, | |
* arguments | |
) |
So that the tests with K2 could be run as simple as:
./gradlew :dokka-integration-tests:gradle:integrationTest
--tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest
-Porg.jetbrains.dokka.experimental.tryK2=true
TeamCity
I've prepared a separate TeamCity build configuration (Dokka Integration Tests [K2]) for testing and for future use, it has the same settings as the main tests, but the run trigger is disabled, so you'll have to trigger it manually. Once this issue is fixed, the trigger could be enabled, otherwise we'll see build failures or waste agent time.
The list of tests to be run with K2 could for now be hardcoded inside Build step: Gradle
. It might also be possible to turn each test into a checkbox, and run tests based on enabled checkboxes (this might be convenient for testing new versions or fixes). The checkboxes are not expected to be done as part of this issue as it might take some considerable time to implement.