Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: do not start all services during IT as default #3881

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/service-registration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 0 additions & 9 deletions integration-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand All @@ -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'
}
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand All @@ -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')
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -269,7 +263,6 @@ task runContainerTests(type: Test) {

outputs.cacheIf { false }
systemProperty "environment.config", "-docker"
systemProperty "environment.offPlatform", "true"

systemProperties System.properties
useJUnitPlatform {
Expand Down Expand Up @@ -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 }

Expand Down Expand Up @@ -436,7 +428,6 @@ task runZaasTest(type: Test) {
description "Run Zaas tests only"

outputs.cacheIf { false }
systemProperty "environment.offPlatform", true

systemProperties System.getProperties()
useJUnitPlatform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface TestWithStartedInstances {
@BeforeEach
default void beforeAllTests() {
FullApiMediationLayer apiml = FullApiMediationLayer.getInstance();
if (!apiml.runsOffPlatform()) {
if (apiml.startServices()) {
FullApiMediationLayer.getInstance().waitUntilReady();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -172,17 +173,17 @@ public void stop() {

cachingService.stop();
zaasService.stop();
if (!attlsEnabled && !runsOffPlatform()) {
if (!attlsEnabled && startServices()) {
nodeJsSampleApp.destroy();
}
} catch (Exception e) {
e.printStackTrace();
}
}

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() {
Expand Down
Loading