diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/EncoderServer.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/EncoderServer.kt index 5420b0f6669..5b61aedf94d 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/EncoderServer.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/EncoderServer.kt @@ -7,6 +7,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.intellij.execution.configurations.GeneralCommandLine import com.intellij.execution.process.KillableProcessHandler import com.intellij.openapi.Disposable +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.process.ProcessCloseUtil import com.intellij.util.io.HttpRequests @@ -56,6 +57,9 @@ class EncoderServer(val project: Project) : Disposable { private val mapper = jacksonObjectMapper() fun downloadArtifactsAndStartServer() { + if (ApplicationManager.getApplication().isUnitTestMode) { + return + } downloadArtifactsIfNeeded() start() } diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt index dcf29c19d71..0432b6f848b 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextProvider.kt @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import com.intellij.openapi.Disposable +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.BaseProjectDirectories.Companion.getBaseDirectories import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VfsUtilCore @@ -41,6 +42,10 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En init { cs.launch { + if (ApplicationManager.getApplication().isUnitTestMode) { + return@launch + } + while (true) { if (encoderServer.isNodeProcessRunning()) { // TODO: need better solution for this