From bf80555562ffa78baf50cf8e29106c8a54b61c90 Mon Sep 17 00:00:00 2001 From: achmelo <37397715+achmelo@users.noreply.github.com> Date: Wed, 6 Nov 2024 17:57:17 +0100 Subject: [PATCH] chore: do not start all services during IT as default (#3881) Signed-off-by: ac892247 --- .github/workflows/integration-tests.yml | 36 +++++++++---------- .github/workflows/service-registration.yml | 2 +- integration-tests/README.md | 5 ++- integration-tests/build.gradle | 9 ----- .../apiml/util/StartAndCleanApplications.java | 2 +- .../apiml/util/TestWithStartedInstances.java | 2 +- .../util/service/FullApiMediationLayer.java | 9 ++--- 7 files changed, 28 insertions(+), 37 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b3e25359d8..9ae5aeabc0 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -134,7 +134,7 @@ jobs: - name: Run CI Tests run: > - ./gradlew :integration-tests:runOidcTests --info -Denvironment.config=-docker -Denvironment.offPlatform=true -Dokta.client.id=${{ secrets.OKTA_CLIENT_ID }} + ./gradlew :integration-tests:runOidcTests --info -Denvironment.config=-docker -Dokta.client.id=${{ secrets.OKTA_CLIENT_ID }} -Doidc.test.user=${{ secrets.OIDC_TEST_USER }} -Doidc.test.pass=${{ secrets.OIDC_TEST_PASS }} -Doidc.test.alt_user=${{ secrets.OKTA_WINNIE_USER }} -Doidc.test.alt_pass=${{ secrets.OKTA_WINNIE_PASS }} -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} @@ -194,7 +194,7 @@ jobs: - name: Run CI Tests run: > - ./gradlew :integration-tests:runGatewayProxyTest --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runGatewayProxyTest --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} - name: Dump CGW jacoco data @@ -242,7 +242,7 @@ jobs: - name: Run CI Tests run: > - ./gradlew :integration-tests:runGatewayServiceRoutingTest --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runGatewayServiceRoutingTest --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} - name: Dump CGW jacoco data @@ -335,7 +335,7 @@ jobs: - name: Run CI Tests run: > - ./gradlew :integration-tests:runGatewayCentralRegistryTest --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runGatewayCentralRegistryTest --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} - name: Dump CGW jacoco data @@ -388,7 +388,7 @@ jobs: - name: Run CI Tests run: > - ./gradlew :integration-tests:runRegistrationTests --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runRegistrationTests --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} # Coverage results are not stored in this job as it would not provide much additional data @@ -460,7 +460,7 @@ jobs: - name: Build with Gradle run: > - ./gradlew :integration-tests:runZaasTest --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runZaasTest --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} -Dokta.client.id=${{ secrets.OKTA_CLIENT_ID }} -Doidc.test.user=${{ secrets.OIDC_TEST_USER }} -Doidc.test.pass=${{ secrets.OIDC_TEST_PASS }} -Doidc.test.alt_user=${{ secrets.OKTA_WINNIE_USER }} @@ -525,7 +525,7 @@ jobs: - name: Build with Gradle run: > - ./gradlew :integration-tests:runZosmfAuthTest --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runZosmfAuthTest --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} # Coverage results are not stored in this job as it would not provide much additional data - name: Store results @@ -562,7 +562,7 @@ jobs: - name: Run Caching Service tests run: > - ./gradlew :integration-tests:runCachingServiceTests --info -Denvironment.offPlatform=true + ./gradlew :integration-tests:runCachingServiceTests --info -DtlsConfiguration.clientKeyStore=../docker/redis/redis-containers/keystore/all-services.keystore.p12 -DtlsConfiguration.keyAlias=apimtst -DtlsConfiguration.keyStore=../docker/redis/redis-containers/keystore/all-services.keystore.p12 @@ -628,7 +628,7 @@ jobs: - name: Run Caching Service tests run: > - ./gradlew :integration-tests:runCachingServiceTests --info -Denvironment.offPlatform=true + ./gradlew :integration-tests:runCachingServiceTests --info -DtlsConfiguration.clientKeyStore=../docker/redis/redis-containers/keystore/all-services.keystore.p12 -DtlsConfiguration.keyAlias=apimtst -DtlsConfiguration.keyStore=../docker/redis/redis-containers/keystore/all-services.keystore.p12 @@ -741,7 +741,7 @@ jobs: - name: Run HA Tests run: > - ./gradlew runHATests --info -Denvironment.config=-ha -Denvironment.offPlatform=true + ./gradlew runHATests --info -Denvironment.config=-ha -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} @@ -830,7 +830,7 @@ jobs: - name: Run HA Tests run: > - ./gradlew runDeterministicLbHaTests --info -Denvironment.config=-ha -Denvironment.offPlatform=true + ./gradlew runDeterministicLbHaTests --info -Denvironment.config=-ha -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} @@ -926,7 +926,7 @@ jobs: - name: Run HA Tests run: > - ./gradlew runStickySessionLbHaTests --info -Denvironment.config=-ha -Denvironment.offPlatform=true + ./gradlew runStickySessionLbHaTests --info -Denvironment.config=-ha -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} @@ -1003,7 +1003,7 @@ jobs: - name: Run Discovery Service Chaotic HA Tests run: > ./gradlew :integration-tests:runChaoticHATests --tests org.zowe.apiml.integration.ha.DiscoveryChaoticTest - --info -Denvironment.config=-ha -Denvironment.offPlatform=true + --info -Denvironment.config=-ha -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} @@ -1076,7 +1076,7 @@ jobs: - name: Run Gateway Service Chaotic HA Tests run: > ./gradlew :integration-tests:runChaoticHATests --tests org.zowe.apiml.integration.ha.GatewayChaoticTest - --info -Denvironment.config=-ha -Denvironment.offPlatform=true + --info -Denvironment.config=-ha -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} @@ -1153,7 +1153,7 @@ jobs: - name: Run Discoverable Client Chaotic HA Tests run: > ./gradlew :integration-tests:runChaoticHATests --tests org.zowe.apiml.integration.ha.SouthboundServiceChaoticTest - --info -Denvironment.config=-ha -Denvironment.offPlatform=true + --info -Denvironment.config=-ha -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} @@ -1230,7 +1230,7 @@ jobs: - name: Run WebSocket Chaotic HA Tests run: > ./gradlew :integration-tests:runChaoticHATests --tests org.zowe.apiml.integration.ha.WebSocketChaoticTest - --info -Denvironment.config=-ha -Denvironment.offPlatform=true + --info -Denvironment.config=-ha -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} @@ -1318,7 +1318,7 @@ jobs: - name: Build with Gradle run: > - ./gradlew :integration-tests:runInfinispanServiceTests --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runInfinispanServiceTests --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} - uses: ./.github/actions/dump-jacoco @@ -1446,7 +1446,7 @@ jobs: - name: Run Service ID Prefix Replacer Tests run: > - ./gradlew :integration-tests:runIdPrefixReplacerTests --info -Denvironment.config=-docker -Denvironment.offPlatform=true + ./gradlew :integration-tests:runIdPrefixReplacerTests --info -Denvironment.config=-docker -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} - name: Store results diff --git a/.github/workflows/service-registration.yml b/.github/workflows/service-registration.yml index 871b20faa4..593d7dc07e 100644 --- a/.github/workflows/service-registration.yml +++ b/.github/workflows/service-registration.yml @@ -31,7 +31,7 @@ jobs: ./gradlew clean build --info --scan - name: Run startup check run: > - ./gradlew runStartUpCheck --info --scan + ./gradlew runStartUpCheck --info --scan -Denvironment.startServices=true - name: Store results uses: actions/upload-artifact@v4 if: always() diff --git a/integration-tests/README.md b/integration-tests/README.md index 3f26fee4e8..c842e491fd 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -68,7 +68,7 @@ In this case you are using either Windows machine or want to start services your 4. Run integration tests ```sh - ./gradlew runCITests -Denvironment.offPlatform=true + ./gradlew runCITests ``` ## The services run elsewhere @@ -82,8 +82,7 @@ In this case the services are running somewhere, and the integration tests verif ```sh ./gradlew runAllIntegrationTests \ -Dcredentials.user=${MF_USERID} \ - -Dcredentials.password=${MF_PASSWORD} \ - -Denvironment.offPlatform=true + -Dcredentials.password=${MF_PASSWORD} ``` ## Manual testing of Discovery Service in HTTP mode diff --git a/integration-tests/build.gradle b/integration-tests/build.gradle index 43bed0e7d8..f7b9089271 100644 --- a/integration-tests/build.gradle +++ b/integration-tests/build.gradle @@ -80,7 +80,6 @@ task startUpCheck(type: Test) { description "Check that the API Mediation Layer is up and runnig" systemProperties System.properties - systemProperty "environment.offPlatform", true useJUnitPlatform { includeTags 'StartupCheck' } @@ -92,7 +91,6 @@ task environmentCheck(type: Test) { description "Check that the Integration environment is healthy" systemProperties System.properties - systemProperty "environment.offPlatform", true useJUnitPlatform { includeTags 'EnvironmentCheck' } @@ -137,7 +135,6 @@ task runAllIntegrationTestsNormal(type: Test) { group "Integration tests" description "Run all integration tests normal" systemProperties System.properties - systemProperty "environment.offPlatform", true useJUnitPlatform { excludeTags( 'StartupCheck', @@ -165,7 +162,6 @@ task runAllIntegrationTests(type: Test) { String itags = System.getProperty("includeTags") ? System.getProperty("includeTags") : 'zOSMFAuthTest' systemProperties System.properties - systemProperty "environment.offPlatform", true useJUnitPlatform { includeTags( itags @@ -185,7 +181,6 @@ task runAllIntegrationTestsForZoweTestingOnZos(type: Test) { def targetSystem = System.getenv("ZOS_TARGET_SYS") ? "-" + System.getenv("ZOS_TARGET_SYS") : "" systemProperty "environment.config", targetSystem - systemProperty "environment.offPlatform", "true" systemProperty "environment.zos.target", "true" systemProperties System.properties systemProperties.remove('java.endorsed.dirs') @@ -215,7 +210,6 @@ task runAllIntegrationTestsForZoweTesting(type: Test) { group "Integration tests" description "Run all integration tests for Zowe testing" - systemProperty "environment.offPlatform", "true" systemProperties System.properties useJUnitPlatform { @@ -269,7 +263,6 @@ task runContainerTests(type: Test) { outputs.cacheIf { false } systemProperty "environment.config", "-docker" - systemProperty "environment.offPlatform", "true" systemProperties System.properties useJUnitPlatform { @@ -299,7 +292,6 @@ task runContainerTests(type: Test) { task runBaseTests(type: Test) { group "integration tests" description "Run base tests" - systemProperty "environment.offPlatform", "true" outputs.cacheIf { false } @@ -436,7 +428,6 @@ task runZaasTest(type: Test) { description "Run Zaas tests only" outputs.cacheIf { false } - systemProperty "environment.offPlatform", true systemProperties System.getProperties() useJUnitPlatform { diff --git a/integration-tests/src/test/java/org/zowe/apiml/util/StartAndCleanApplications.java b/integration-tests/src/test/java/org/zowe/apiml/util/StartAndCleanApplications.java index 27e1c02c72..400cb85c5c 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/util/StartAndCleanApplications.java +++ b/integration-tests/src/test/java/org/zowe/apiml/util/StartAndCleanApplications.java @@ -25,7 +25,7 @@ public StartAndCleanApplications() { @Override public void testPlanExecutionStarted(TestPlan testPlan) { - if (!fullApiMediationLayer.runsOffPlatform()) { + if (fullApiMediationLayer.startServices()) { log.info("Starting Full API Mediation Layer"); fullApiMediationLayer.start(); } diff --git a/integration-tests/src/test/java/org/zowe/apiml/util/TestWithStartedInstances.java b/integration-tests/src/test/java/org/zowe/apiml/util/TestWithStartedInstances.java index 368ac584a3..70bdd2d66d 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/util/TestWithStartedInstances.java +++ b/integration-tests/src/test/java/org/zowe/apiml/util/TestWithStartedInstances.java @@ -17,7 +17,7 @@ public interface TestWithStartedInstances { @BeforeEach default void beforeAllTests() { FullApiMediationLayer apiml = FullApiMediationLayer.getInstance(); - if (!apiml.runsOffPlatform()) { + if (apiml.startServices()) { FullApiMediationLayer.getInstance().waitUntilReady(); } } diff --git a/integration-tests/src/test/java/org/zowe/apiml/util/service/FullApiMediationLayer.java b/integration-tests/src/test/java/org/zowe/apiml/util/service/FullApiMediationLayer.java index 1f0fb4713c..0ca1c21d86 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/util/service/FullApiMediationLayer.java +++ b/integration-tests/src/test/java/org/zowe/apiml/util/service/FullApiMediationLayer.java @@ -11,6 +11,7 @@ package org.zowe.apiml.util.service; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.zowe.apiml.startup.impl.ApiMediationLayerStartupChecker; import org.zowe.apiml.util.config.ConfigReader; @@ -172,7 +173,7 @@ public void stop() { cachingService.stop(); zaasService.stop(); - if (!attlsEnabled && !runsOffPlatform()) { + if (!attlsEnabled && startServices()) { nodeJsSampleApp.destroy(); } } catch (Exception e) { @@ -180,9 +181,9 @@ public void stop() { } } - public boolean runsOffPlatform() { - String offPlatform = System.getProperty("environment.offPlatform"); - return offPlatform != null && !offPlatform.isEmpty() && Boolean.parseBoolean(offPlatform); + public boolean startServices() { + String startServices = System.getProperty("environment.startServices"); + return StringUtils.isNotEmpty(startServices) && Boolean.parseBoolean(startServices); } public void waitUntilReady() {