Skip to content

Commit

Permalink
Merge pull request #2362 from O-sura/dptocp
Browse files Browse the repository at this point in the history
Merging agent-integration-tests into the apk cucumber-tests
  • Loading branch information
CrowleyRajapakse authored May 8, 2024
2 parents 7842cf5 + 71abe1d commit 6090a45
Show file tree
Hide file tree
Showing 62 changed files with 8,123 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/agent-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ jobs:
- name: Run test cases
shell: sh
run: |
cd apk-repo/test/apim-apk-agent-test/cucumber-tests
sh ./scripts/setup-hosts.sh
./gradlew runTests
cd apk-repo/test/cucumber-tests
sh ./scripts/agent-setup-hosts.sh
./gradlew runCpToDpTests
- name: Helm release undeploy
if: always()
shell: sh
Expand Down Expand Up @@ -134,5 +134,5 @@ jobs:
if: always()
uses: malinthaprasan/action-surefire-report@v1
with:
report_paths: 'apk-repo/test/apim-apk-agent-test/cucumber-tests/build/test-output/junitreports/*.xml'
report_paths: 'apk-repo/test/cucumber-tests/build/test-output/junitreports/*.xml'
fail_on_test_failures: true
33 changes: 33 additions & 0 deletions test/cucumber-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ repositories {
mavenCentral()
}

def AgentCpToDpTestFeatures = 'src/test/resources/tests/agent-cptodp'
def AgentDpToCpTestFeatures = 'src/test/resources/tests/agent-dptocp'
def APKConfigTestFeatures = 'src/test/resources/tests/config'
def APKTestFeatures = 'src/test/resources/tests/api'

dependencies {
testImplementation 'io.cucumber:cucumber-picocontainer:7.2.3'
testImplementation 'io.cucumber:cucumber-core:7.2.3'
Expand All @@ -35,6 +40,7 @@ dependencies {
testImplementation 'io.cucumber:cucumber-testng:7.13.0'
testImplementation 'commons-io:commons-io:2.13.0'
testImplementation 'com.nimbusds:nimbus-jose-jwt:9.31'
testImplementation 'com.googlecode.json-simple:json-simple:1.1.1'
}

test {
Expand All @@ -52,5 +58,32 @@ task runTests(type: JavaExec, dependsOn: 'classes') {
project.sourceSets.test.compileClasspath,
project.sourceSets.main.runtimeClasspath,
project.sourceSets.test.runtimeClasspath)
systemProperty 'cucumber.features', "$APKConfigTestFeatures,$APKTestFeatures"
systemProperty 'http.client.setup', 'apk'
args = ["-d", "./build/test-output", "./src/test/resources/testng.xml"]
}


task runCpToDpTests(type: JavaExec, dependsOn: 'classes') {
main = 'org.testng.TestNG'
classpath = files("./src/test/resources",
project.sourceSets.main.compileClasspath,
project.sourceSets.test.compileClasspath,
project.sourceSets.main.runtimeClasspath,
project.sourceSets.test.runtimeClasspath)
systemProperty 'cucumber.features', AgentCpToDpTestFeatures
systemProperty 'http.client.setup', 'apim-apk'
args = ["-d", "./build/test-output", "./src/test/resources/testng.xml"]
}

task runDpToCpTests(type: JavaExec, dependsOn: 'classes') {
main = 'org.testng.TestNG'
classpath = files("./src/test/resources",
project.sourceSets.main.compileClasspath,
project.sourceSets.test.compileClasspath,
project.sourceSets.main.runtimeClasspath,
project.sourceSets.test.runtimeClasspath)
systemProperty 'cucumber.features', AgentDpToCpTestFeatures
systemProperty 'http.client.setup', 'apim-apk'
args = ["-d", "./build/test-output", "./src/test/resources/testng.xml"]
}
19 changes: 19 additions & 0 deletions test/cucumber-tests/scripts/agent-setup-hosts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
kubectl apply -f ./CRs/artifacts.yaml
kubectl wait deployment/apim-wso2am-cp-deployment-1 -n apk --for=condition=available --timeout=600s
kubectl wait --timeout=5m -n apk deployment/apk-wso2-apk-adapter-deployment --for=condition=Available
kubectl wait --timeout=15m -n apk deployment/apk-wso2-apk-gateway-runtime-deployment --for=condition=Available
kubectl wait --timeout=5m -n apk deployment/apim-apk-agent --for=condition=Available
IP=$(kubectl get svc apk-wso2-apk-gateway-service -n apk --output jsonpath='{.status.loadBalancer.ingress[0].ip}')
ING_IP=$(kubectl get ing -n apk apim-wso2am-cp-ingress --output=jsonpath='{.status.loadBalancer.ingress[0].ip}')
CC_IP=$(kubectl get svc apk-wso2-apk-common-controller-web-server-service -n apk --output jsonpath='{.status.loadBalancer.ingress[0].ip}')
sudo echo "$IP localhost" | sudo tee -a /etc/hosts
sudo echo "$IP idp.am.wso2.com" | sudo tee -a /etc/hosts
sudo echo "$CC_IP apk-wso2-apk-common-controller-service.apk.svc" | sudo tee -a /etc/hosts
sudo echo "$ING_IP am.wso2.com" | sudo tee -a /etc/hosts
sudo echo "$IP api.am.wso2.com" | sudo tee -a /etc/hosts
sudo echo "$IP default.gw.wso2.com" | sudo tee -a /etc/hosts
sudo echo "$IP default.sandbox.gw.wso2.com" | sudo tee -a /etc/hosts
sudo echo "$IP sandbox.default.gw.wso2.com" | sudo tee -a /etc/hosts
sudo echo "255.255.255.255 broadcasthost" | sudo tee -a /etc/hosts
sudo echo "::1 localhost" | sudo tee -a /etc/hosts
Loading

0 comments on commit 6090a45

Please sign in to comment.