mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
BAZEL-2843 [bazel]: make unit tests runnable with Bazel
This change addresses multiple interconnected test failures that occur when running Bazel plugin tests in the Bazel test environment. Problem: When JUnit 5 tests with @BazelTestApplication run alongside JUnit 4 BasePlatformTestCase tests in Bazel, cascading failures occur because: 1. JUnit 5 global store cleanup disposes the test application 2. This permanently shuts down AppScheduledExecutorService singleton 3. Subsequent JUnit 4 tests fail with "Already shutdown" errors Some tests are failing due to different isolation issues in Bazel sendbox. Changes: 1. Skip test application disposal under Bazel (TestApplicationExtension.kt) - The JVM terminates after tests complete anyway - cleanApplicationState() is still called after each test - Aligns with JUnit 4's TestApplicationManager behavior 2. Fix BazelGlobalFunctions test isolation (BazelGlobalFunctions.kt) - Change companion object properties from static initialization to dynamic getters - Prevents stale extension point data when tests mask the extension point 3. Add missing test dependencies (intellij.bazel.pluginTests.iml, BUILD.bazel) - Add platform dependencies (settings-local, backend-main) for service resolution - Add Kotlin plugin dependencies (plugin/common, plugin/k2) for stub indexing in completion tests - Configure test target with Kotlin's all_test_dep_targets data 4. Fix ProjectViewDirectoriesActionTest (ProjectViewDirectoriesActionTestCase.kt) - Replace android.databinding.tool.ext.mapEach with standard Kotlin - Fixes NoClassDefFoundError in Bazel environment 5. Fix KotlinModuleInternalManglingTest (MODULE.bazel, BazelRunner.kt) - Add hermetic_cc_toolchain - Update rules_kotlin to 2.2.2 - Add .bazeliskrc to set BAZELISK_HOME value Merge-request: IJ-MR-189586 Merged-by: Danil Tereshchenko <Danil.Tereshchenko@jetbrains.com> GitOrigin-RevId: e5edb753314fcc87fa06227325985403ff5328a3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0f174fd3be
commit
f0d707adef
@@ -7,6 +7,7 @@ import com.intellij.ide.AppLifecycleListener
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.testFramework.common.*
|
||||
import com.intellij.testFramework.common.BazelTestUtil
|
||||
import com.intellij.util.ui.EDT
|
||||
import kotlinx.coroutines.*
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
@@ -45,6 +46,14 @@ private class TestApplicationResource(val initializationResult: Result<Unit>) :
|
||||
return
|
||||
}
|
||||
|
||||
// In Bazel test environment, don't dispose the application.
|
||||
// The JVM will terminate after all tests complete anyway, and
|
||||
// disposing here would break JUnit 4 tests that run after JUnit 5 tests.
|
||||
// See BAZEL-2843 for details.
|
||||
if (BazelTestUtil.isUnderBazelTest) {
|
||||
return
|
||||
}
|
||||
|
||||
runBlocking {
|
||||
withTimeout(Duration.ofSeconds(20).toMillis()) {
|
||||
withContext(Dispatchers.EDT) {
|
||||
|
||||
Reference in New Issue
Block a user