From 45bce6aaa7c64e97e2f91f793443fd78acfb45ef Mon Sep 17 00:00:00 2001 From: fscarponi Date: Tue, 5 Mar 2024 18:22:33 +0100 Subject: [PATCH] fix test --- .github/workflows/test.yml | 2 +- plugin/src/test/kotlin/E2ETests.kt | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e34dc09..75c725d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,4 +37,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: testResult-${{ matrix.os }}-${{ matrix.gradle-versions }} - path: /Users/runner/work/package-search-intellij-plugin/plugin/build/testData \ No newline at end of file + path: /home/runner/work/package-search-intellij-plugin/package-search-intellij-plugin/plugin/build/testData \ No newline at end of file diff --git a/plugin/src/test/kotlin/E2ETests.kt b/plugin/src/test/kotlin/E2ETests.kt index 788b44c9..2cc9594c 100644 --- a/plugin/src/test/kotlin/E2ETests.kt +++ b/plugin/src/test/kotlin/E2ETests.kt @@ -89,9 +89,9 @@ class E2ETests { System.getenv("GRADLE_VERSION")?.let { Log.warn("patching project's gradle version to $it") - patchGradleVersion(it, projectDir)?.let { - it.copyTo(PKGS_TEST_DATA_OUTPUT_DIR.resolve("patched-gradle-wrapper.properties"), overwrite = true) - } + val pachedGradleFile= patchGradleVersion(it, projectDir) + + pachedGradleFile?.copyTo(PKGS_TEST_DATA_OUTPUT_DIR.resolve("patched-gradle-wrapper.properties"), overwrite = true) } val testContext = buildIdeContext(projectDir) @@ -130,9 +130,9 @@ class E2ETests { ?: error { "assertion data not found for project $projectName" } ) - assertNotNull(expected.value) { + assertNotNull(expected.value, "deserialization of expected result failed or is null for project $projectName" - } + ) assertNotNull( result.value, "deserialization of test result failed or is null for project $projectName" @@ -140,14 +140,21 @@ class E2ETests { assert(expected.value?.keys?.any { it !in (result.value?.keys ?: emptySet()) } ?: false) { - "expected MODULE keys differ from result keys" + buildString{ + appendLine("expected MODULE keys differ from result keys") + appendLine("expected: ${expected.value?.keys}") + appendLine("result: ${result.value?.keys}") + } } expected.value?.forEach { (key, value) -> - assertNotNull(result.value?.get(key), - "expected module $key not found in result modules" + - " ( result module: ${result.value?.keys} )" + - " ( expected module: ${expected.value?.keys} )" + assertNotNull( + result.value?.get(key), + buildString { + appendLine("expected module $key not found in result modules") + appendLine(" ( result module: ${result.value?.keys} )") + appendLine(" ( expected module: ${expected.value?.keys} )") + } ) result.value?.get(key)?.let { validateModule(value, it)