From 9277a41a89ef73f8f90170914146e74a6bdb2925 Mon Sep 17 00:00:00 2001 From: Fabrizio Scarponi <36624359+fscarponi@users.noreply.github.com> Date: Thu, 23 May 2024 20:19:11 +0200 Subject: [PATCH] 233 - Add test for non existent module declaration (#181) * Add a non existent module in setting gradle file to check to ensure it's supported * Fix assertions in test result validation The test assertion mechanism was updated in the project service validation tests. Instead of checking presence of every expected key into the result keys set individually, now the equality of sets is checked. Additionally, data for a non-existent module was added to the pkgs-test-java.json, this will help testing scenarios where the tested project doesn't have some prerequisites. * Fix publication workflow --- .github/workflows/publish-release.yml | 4 +++- .../end2end/projectservice/Validation.kt | 6 +++-- .../projects/gradle/pkgs-test-java.json | 21 ++++++++++++++++++ .../projects/gradle/pkgs-test-java.zip | Bin 91014 -> 91068 bytes 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 76a5201e..393101f9 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -10,6 +10,7 @@ jobs: name: Publish Package Search to Marketplace runs-on: ubuntu-latest env: + TOOLBOX_ENTERPRISE_TOKEN: ${{ secrets.TOOLBOX_ENTERPRISE_TOKEN }} MARKETPLACE_TOKEN: ${{ secrets.MARKETPLACE_TOKEN }} GRADLE_ENTERPRISE_KEY: ${{ secrets.GRADLE_ENTERPRISE_KEY }} SPACE_INTELLIJ_NIGHTLIES_TOKEN: ${{ secrets.SPACE_INTELLIJ_NIGHTLIES_TOKEN }} @@ -19,7 +20,6 @@ jobs: RUN_NUMBER: ${{ github.run_number }} RUN_ATTEMPT: ${{ github.run_attempt }} CHANGE_NOTES: ${{ github.event.release.body }} - KMP: true steps: - uses: actions/checkout@v4 with: @@ -33,6 +33,8 @@ jobs: - name: Publish libraries run: ./gradlew publishAllPublicationsToSpaceRepository - name: Publish release plugin to TBE + env: + KMP: true run: ./gradlew :plugin:publishReleasePluginToTBE - name: Publish plugin to Marketplace run: ./gradlew :plugin:publishPluginToMarketplace diff --git a/plugin/src/test/kotlin/com/jetbrains/packagesearch/plugin/tests/end2end/projectservice/Validation.kt b/plugin/src/test/kotlin/com/jetbrains/packagesearch/plugin/tests/end2end/projectservice/Validation.kt index a34f7dd7..70f29df7 100644 --- a/plugin/src/test/kotlin/com/jetbrains/packagesearch/plugin/tests/end2end/projectservice/Validation.kt +++ b/plugin/src/test/kotlin/com/jetbrains/packagesearch/plugin/tests/end2end/projectservice/Validation.kt @@ -51,14 +51,16 @@ internal fun TestScope.validateResult(projectName: String, expectedResultPath: S "Deserialization of test result failed or is null for project $projectName" ) + val expectedKeys = expected.value?.keys ?: emptySet() + val resultKeys = result.value?.keys ?: emptySet() - assertTrue(expected.value?.keys?.all { it in (result.value?.keys ?: emptySet()) } ?: false, + assert(expectedKeys == resultKeys) { 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( diff --git a/plugin/src/test/resources/projects/gradle/pkgs-test-java.json b/plugin/src/test/resources/projects/gradle/pkgs-test-java.json index ba2bb414..6d396e5c 100644 --- a/plugin/src/test/resources/projects/gradle/pkgs-test-java.json +++ b/plugin/src/test/resources/projects/gradle/pkgs-test-java.json @@ -107,6 +107,27 @@ ], "defaultScope": "implementation" }, + "non_existent_module": { + "type": "com.jetbrains.packagesearch.plugin.tests.SerializablePackageSearchModule.Base", + "name": "non_existent_module", + "identity": { + "group": "gradle", + "path": ":non_existent_module" + }, + "declaredRepositories": [], + "compatiblePackageTypes": [ + { + "type": "maven" + }, + { + "type": "gradle" + } + ], + "dependencyMustHaveAScope": true, + "declaredDependencies": [], + "availableScopes": [], + "defaultScope": null + }, "sub-module-1": { "type": "com.jetbrains.packagesearch.plugin.tests.SerializablePackageSearchModule.Base", "name": "sub-module-1", diff --git a/plugin/src/test/resources/projects/gradle/pkgs-test-java.zip b/plugin/src/test/resources/projects/gradle/pkgs-test-java.zip index 7132f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