-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add integration tests for mediator (#9)
Signed-off-by: abalias <[email protected]> Signed-off-by: Shailesh Patil <[email protected]>
- Loading branch information
1 parent
3106b37
commit c6af8c7
Showing
35 changed files
with
1,603 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
name: End-to-end tests | ||
|
||
concurrency: | ||
group: ${{ github.head_ref }}${{ github.ref }}-integration-tests | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "main" | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: "tests/mediator-integration-tests" | ||
|
||
jobs: | ||
run-integration-tests: | ||
name: "Run integration tests" | ||
runs-on: ubuntu-latest | ||
env: | ||
REPORTS_DIR: "tests/mediator-integration-tests/target/site/serenity" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Java and Scala | ||
uses: olafurpg/setup-scala@v13 | ||
with: | ||
java-version: [email protected] | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
password: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
|
||
- name: Install Compose | ||
uses: ndeloof/[email protected] | ||
with: | ||
version: v2.12.2 # defaults to 'latest' | ||
legacy: true # will also install in PATH as `docker-compose` | ||
|
||
- name: Build local version of Mediator Agent | ||
env: | ||
MEDIATOR_PATH: "../.." | ||
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
run: | | ||
cd "${MEDIATOR_PATH}" || exit 129 | ||
NODE_OPTIONS=--openssl-legacy-provider sbt -mem 2048 -J-Xmx5120m docker:publishLocal | ||
MEDIATOR_VERSION=$(cut version.sbt -d '=' -f2 | tr -d '" ') | ||
echo ${MEDIATOR_VERSION} | ||
- name: Start Mediator | ||
uses: isbang/[email protected] | ||
with: | ||
compose-file: "./docker-compose.yml" | ||
compose-flags: "" | ||
up-flags: "--wait" | ||
down-flags: "--volumes" | ||
|
||
- name: Run e2e tests | ||
env: | ||
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
ATALA_GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
MEDIATOR_PEER_DID: "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9rOHMtaW50LmF0YWxhcHJpc20uaW8vbWVkaWF0b3IiLCJyIjpbXSwiYSI6WyJkaWRjb21tL3YyIl19" | ||
continue-on-error: true | ||
run: | | ||
./gradlew test || true | ||
./gradlew reports | ||
# - name: Update X-Ray test execution | ||
# uses: ./.github/actions/upload-to-xray | ||
# if: github.ref_name == 'main' | ||
# with: | ||
# username: ${{ secrets.XRAY_CLIENT_ID }} | ||
# password: ${{ secrets.XRAY_CLIENT_SECRET }} | ||
# json: "tests/e2e-tests/target/serenity-reports/cucumber_report.json" | ||
# execution_tag: ${{ env.XRAY_EXECUTION_TAG_LOCALHOST }} | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: e2e-tests-result | ||
path: ${{ env.REPORTS_DIR }} | ||
|
||
- name: Publish e2e test Results | ||
if: always() | ||
id: publish-unit-tests | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
with: | ||
junit_files: "${{ env.REPORTS_DIR }}/SERENITY-JUNIT-*.xml" | ||
comment_title: "Integration Test Results" | ||
check_name: "Integration Test Results" | ||
|
||
- name: Extract test results | ||
id: analyze_test_results | ||
if: github.ref_name == 'main' | ||
run: | | ||
JSON_RESULTS="target/site/serenity/serenity-summary.json" | ||
CONCLUSION=failure | ||
TOTAL_TESTS=0 | ||
FAILED_TESTS=0 | ||
SKIPPED_TESTS=0 | ||
TESTS_WITH_ERRORS=0 | ||
if [ -f "${JSON_RESULTS}" ]; then | ||
TOTAL_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.total')" | ||
PENDING_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.pending')" | ||
SKIPPED_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.skipped')" | ||
IGNORED_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.ignored')" | ||
FAILED_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.failure')" | ||
TESTS_WITH_ERRORS="$(cat ${JSON_RESULTS} | jq '.results.counts.error')" | ||
if [[ ${FAILED_TESTS} == 0 && ${TESTS_WITH_ERRORS} == 0 ]] ; then | ||
CONCLUSION=success | ||
fi | ||
fi | ||
{ | ||
echo "slack_report_failure=${SLACK_REPORT_FAILURE}"; | ||
echo "conclusion=${CONCLUSION}"; | ||
echo "tests=${TOTAL_TESTS}"; | ||
echo "failures=${FAILED_TESTS}"; | ||
echo "errors=${TESTS_WITH_ERRORS}"; | ||
echo "pending=${PENDING_TESTS}"; | ||
echo "skipped=${SKIPPED_TESTS}"; | ||
echo "ignored=${IGNORED_TESTS}"; | ||
} >> "$GITHUB_OUTPUT" | ||
- name: Slack Notification | ||
if: github.ref_name == 'main' && steps.analyze_test_results.outputs.conclusion == 'failure' | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_COLOR: ${{ steps.analyze_test_results.outputs.conclusion }} | ||
SLACK_MESSAGE: | | ||
Total: ${{ steps.analyze_test_results.outputs.tests }} | ||
Failed: ${{ steps.analyze_test_results.outputs.failures }} | ||
Errors in tests: ${{ steps.analyze_test_results.outputs.errors }} | ||
Skipped (known bugs): ${{ steps.analyze_test_results.outputs.skipped }} | ||
SLACK_TITLE: "Mediator Integration tests: ${{ steps.analyze_test_results.outputs.conclusion }}" | ||
SLACK_USERNAME: circleci | ||
SLACK_WEBHOOK: ${{ secrets.E2E_TESTS_SLACK_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
plugins { | ||
kotlin("jvm") version "1.8.21" | ||
kotlin("plugin.serialization") version "1.8.21" | ||
idea | ||
jacoco | ||
id("net.serenity-bdd.serenity-gradle-plugin") version "3.4.2" | ||
} | ||
|
||
group = "io.iog.mediator.tests" | ||
version = "0.1.0-SNAPSHOT" | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { | ||
this.url = uri("https://maven.pkg.github.com/input-output-hk/atala-prism-wallet-sdk-kmm") | ||
credentials { | ||
this.username = System.getenv("ATALA_GITHUB_ACTOR") | ||
this.password = System.getenv("ATALA_GITHUB_TOKEN") | ||
} | ||
} | ||
maven { | ||
this.url = uri("https://maven.pkg.github.com/input-output-hk/atala-prism-apollo") | ||
credentials { | ||
this.username = System.getenv("ATALA_GITHUB_ACTOR") | ||
this.password = System.getenv("ATALA_GITHUB_TOKEN") | ||
} | ||
} | ||
maven { | ||
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven") | ||
} | ||
} | ||
|
||
dependencies { | ||
// Logging | ||
implementation("org.slf4j:slf4j-log4j12:2.0.5") | ||
// Beautify async waits | ||
implementation("org.awaitility:awaitility-kotlin:4.2.0") | ||
// Test engines and reports | ||
testImplementation("junit:junit:4.13.2") | ||
implementation("net.serenity-bdd:serenity-core:3.4.3") | ||
implementation("net.serenity-bdd:serenity-cucumber:3.4.3") | ||
implementation("net.serenity-bdd:serenity-screenplay-rest:3.4.3") | ||
// https://mvnrepository.com/artifact/net.serenity-bdd/serenity-ensure | ||
testImplementation("net.serenity-bdd:serenity-ensure:3.4.3") | ||
// Beautify exceptions handling assertions | ||
testImplementation("org.assertj:assertj-core:3.23.1") | ||
// Navigate through Json with xpath | ||
testImplementation("com.jayway.jsonpath:json-path:2.7.0") | ||
implementation("io.iohk.atala.prism.walletsdk:atala-prism-sdk:0.1.1") | ||
implementation("org.didcommx:didcomm:0.3.0") | ||
implementation("org.didcommx:peerdid:0.3.0") | ||
implementation("io.ktor:ktor-server-netty:2.3.0") | ||
implementation("io.ktor:ktor-client-apache:2.3.0") | ||
|
||
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp | ||
implementation("com.squareup.okhttp3:okhttp:4.11.0") | ||
|
||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") | ||
|
||
} | ||
|
||
buildscript { | ||
dependencies { | ||
classpath("net.serenity-bdd:serenity-single-page-report:3.4.3") | ||
classpath("net.serenity-bdd:serenity-json-summary-report:3.4.3") | ||
} | ||
} | ||
|
||
/** | ||
* Add HTML one-pager and JSON summary report to be produced | ||
*/ | ||
serenity { | ||
reports = listOf("single-page-html", "json-summary") | ||
} | ||
|
||
tasks.test { | ||
testLogging.showStandardStreams = true | ||
systemProperty("cucumber.filter.tags", System.getProperty("cucumber.filter.tags")) | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(11) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kotlin.code.style=official | ||
org.gradle.parallel=false | ||
org.gradle.workers.max=1 |
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
tests/mediator-integration-tests/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.