Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ide Tests fails with 'com.intellij.platform.instanceContainer.InstanceNotRegisteredException: com.intellij.platform.settings.SettingsController' after updating to 2.1.X+ #1834

Open
sbouchet opened this issue Dec 5, 2024 · 6 comments

Comments

@sbouchet
Copy link

sbouchet commented Dec 5, 2024

What happened?

Our Integration test suite starts to fails after updating to 2.1.0.
the tests overrides BasePlatformTestCase and its fails into the setUp() pahse, while initializingthe fixture.
everything runs fine with no change using 2.0.1

Relevant log output or stack trace

com.intellij.platform.instanceContainer.InstanceNotRegisteredException: com.intellij.platform.settings.SettingsController
        at com.intellij.platform.instanceContainer.internal.InstanceContainerImpl.instance(InstanceContainerImpl.kt:65)
        at com.intellij.serviceContainer.ComponentManagerImpl.getServiceAsync(ComponentManagerImpl.kt:699)
        at com.intellij.platform.ide.bootstrap.ApplicationLoader$initConfigurationStore$2$1.invokeSuspend(ApplicationLoader.kt:586)
        at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt:42)
        at com.intellij.testFramework.common.TestApplicationKt$loadAppInUnitTestMode$task$1.invokeSuspend(testApplication.kt:172)
        at com.intellij.testFramework.common.TestApplicationKt$loadAppInUnitTestMode$3.invokeSuspend(testApplication.kt:182)
        at com.intellij.openapi.progress.impl.PlatformTaskSupport$runWithModalProgressBlockingInternal$2$taskJob$1.invokeSuspend(PlatformTaskSupport.kt:216)

        Caused by:
        com.intellij.platform.instanceContainer.InstanceNotRegisteredException: com.intellij.platform.settings.SettingsController
            at com.intellij.platform.instanceContainer.internal.InstanceContainerImpl.instance(InstanceContainerImpl.kt:65)
            at com.intellij.serviceContainer.ComponentManagerImpl.getServiceAsync(ComponentManagerImpl.kt:699)
            at com.intellij.platform.ide.bootstrap.ApplicationLoader$initConfigurationStore$2$1.invokeSuspend(ApplicationLoader.kt:586)
            at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
            at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
            at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
            at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
            at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
            at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)

Steps to reproduce

checkout https://github.com/redhat-developer/intellij-openshift-connector, update gradle intelij plugin to 2.1.0 in libs.toml and run ./gradlew integrationTest. see the failures messages
whereas when no changes, there is expected failures due to missing kubernetes cluster ( kind ) , but ToolFactoryTest for example is fine

Gradle IntelliJ Plugin version

2.1.0

Gradle version

8.5

Operating System

Linux

Link to build, i.e. failing GitHub Action job

https://github.com/redhat-developer/intellij-openshift-connector/actions/runs/12164905013/job/33928092232?pr=948

@hsz
Copy link
Member

hsz commented Dec 5, 2024

Hey, Stephane!
I see you're introducing a custom source set for your instrumentation tests. Unfortunately, this approach hasn't been properly tested yet.

Looking at the test module's dependencies, the idea:ideaIC:aarch64:2024.3 dependency is present.
We can see a listing of all required jars to run IDE or tests in its details.

image

However, for the it module, ideaIC is absent. This may be because the IntelliJ Platform dependency is resolved from the Internet, i.e., the DMG archive (on macOS), and still requires dependency transformation to be executed—like extracting the archive and collecting relevant jars.

For the compileClasspath/runtimeClasspath/test* configurations, the IntelliJ Platform Gradle Plugin adds special attributes that instruct Gradle to take care of those custom archives properly:

listOf(
project.configurations[Configurations.External.COMPILE_CLASSPATH],
project.configurations[Configurations.External.RUNTIME_CLASSPATH],
project.configurations[Configurations.External.TEST_COMPILE_CLASSPATH],
project.configurations[Configurations.External.TEST_RUNTIME_CLASSPATH],
project.configurations[Configurations.INTELLIJ_PLATFORM_CLASSPATH],
project.configurations[Configurations.INTELLIJ_PLATFORM_TEST_CLASSPATH],
).forEach {
it.attributes
.attribute(Attributes.extracted, true)
.attribute(Attributes.collected, true)
}

They're most likely missing, and you include a raw DMG archive for the it classpath.

@sbouchet sbouchet changed the title Ide Tests fails with 'com.intellij.platform.instanceContainer.InstanceNotRegisteredException: com.intellij.platform.settings.SettingsController' after updating to 2.1.0 Ide Tests fails with 'com.intellij.platform.instanceContainer.InstanceNotRegisteredException: com.intellij.platform.settings.SettingsController' after updating to 2.1.X+ Dec 13, 2024
@sbouchet
Copy link
Author

For info, same error with latest 2.2.0

@sbouchet
Copy link
Author

what can i see for now is different. however, the scope is different ( from provided to runtime). is there a task i can use to print the classpath and scope for better understanding/diff ?

@hsz
Copy link
Member

hsz commented Dec 13, 2024

To inspect the classpath used by the test task, you can:

tasks {
    test {
        doFirst {
            println("classpath = \n${classpath.joinToString("\n")}")
        }
    }
}

@sbouchet
Copy link
Author

sbouchet commented Dec 17, 2024

With your above task, i can spot that the custom integrationtest classpath is missing a lot of IJ modules, compared to the simple test. i suppose this is likely why it's failling...
one module missing is.. /home/sbouchet/.gradle/caches/transforms-3/7763e09ed2e3841d8b453ea8d0b814fa/transformed/ideaIC-2024.3/lib/modules/intellij.platform.settings.local.jar
so how do i add those modules to the classpath ?

image

@vbmacher
Copy link

Hi all, I had similar issue with my plugin https://github.com/vbmacher/intellij-cucumber-scala - tests throwing

[info] - testLineMarker *** FAILED ***
[info]   com.intellij.platform.instanceContainer.InstanceNotRegisteredException: com.intellij.platform.settings.SettingsController
[info]   at com.intellij.platform.instanceContainer.internal.InstanceContainerImpl.instance(InstanceContainerImpl.kt:65)
[info]   at com.intellij.serviceContainer.ComponentManagerImpl.getServiceAsync(ComponentManagerImpl.kt:699)
...

After several months I resolved it just with updating sbt-idea-plugin from version 3.20.1 to 3.26.2 (they don't even show the latest version in releases).

Just saying it's maybe worth checking what has changed between these versions and check if the same kind of changes shouldnt be applied in the gradle plugin (or first maybe try to update it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants