diff --git a/platform/platform-tests/testSrc/com/intellij/execution/wsl/WslRule.kt b/platform/platform-tests/testSrc/com/intellij/execution/wsl/WslRule.kt index 27100a5a3d80..784ce7c18110 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/wsl/WslRule.kt +++ b/platform/platform-tests/testSrc/com/intellij/execution/wsl/WslRule.kt @@ -3,8 +3,8 @@ package com.intellij.execution.wsl import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.util.io.IoTestUtil +import com.intellij.testFramework.ensureCorrectVersion import org.junit.Assume.assumeTrue -import org.junit.jupiter.api.Assumptions import org.junit.rules.ExternalResource import java.io.IOException import kotlin.io.path.exists @@ -36,21 +36,6 @@ class WslFixture private constructor(val vms: List) { companion object { private val LOG = logger() - fun ensureCorrectVersion(wsl: WSLDistribution) { - System.getenv("WSL_VERSION")?.let { - if (it.toInt() != wsl.version) { - val error = """ - Variable provided by environment claims WSL is $it. - But wsl is ${wsl.version}. - Hence, environment provides wrong information. - With all of that, test can't continue. Fix your environment. - """.trimIndent() - logger().warn(error) - Assumptions.abort(error) - } - } - } - @JvmStatic fun create(assume: Boolean = true): WslFixture { if (assume) { diff --git a/platform/testFramework/src/com/intellij/testFramework/WslTeamCityTestTool.kt b/platform/testFramework/src/com/intellij/testFramework/WslTeamCityTestTool.kt new file mode 100644 index 000000000000..1e3f55f2755c --- /dev/null +++ b/platform/testFramework/src/com/intellij/testFramework/WslTeamCityTestTool.kt @@ -0,0 +1,26 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.testFramework + +import com.intellij.execution.wsl.WSLDistribution +import com.intellij.openapi.diagnostic.Logger + +private val LOGGER = Logger.getInstance("WslTeamCityTestTool") + +/** + * Early failure for IJI-1731 + */ +fun ensureCorrectVersion(wsl: WSLDistribution) { + System.getenv("WSL_VERSION")?.let { // This var must be set on TC manually + if (it.toInt() != wsl.version) { + val error = """ + Variable provided by environment claims WSL is $it. + But wsl is ${wsl.version}. + Hence, environment provides wrong information. + With all of that, test can't continue. Fix your environment. + """.trimIndent() + LOGGER.error(error) + error(error) + } + } +} +