diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 185bdfcd..498e5619 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -21,6 +21,10 @@ jobs: name: "Run integration tests" runs-on: ubuntu-latest 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 }} REPORTS_DIR: "tests/mediator-integration-tests/target/site/serenity" steps: - name: Checkout @@ -55,11 +59,10 @@ jobs: - name: Build local version of Mediator Agent env: MEDIATOR_PATH: "../.." - GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} - GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} + NODE_OPTIONS: "--openssl-legacy-provider" run: | cd "${MEDIATOR_PATH}" || exit 129 - NODE_OPTIONS=--openssl-legacy-provider sbt -mem 2048 -J-Xmx5120m docker:publishLocal + sbt -mem 2048 -J-Xmx5120m docker:publishLocal MEDIATOR_VERSION=$(cut version.sbt -d '=' -f2 | tr -d '" ') echo "MEDIATOR_VERSION=${MEDIATOR_VERSION}" >> $GITHUB_ENV echo ${MEDIATOR_VERSION} @@ -71,26 +74,11 @@ jobs: 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: diff --git a/build.sbt b/build.sbt index 0aca5f7d..4e5454d7 100644 --- a/build.sbt +++ b/build.sbt @@ -233,6 +233,7 @@ lazy val mediator = project Docker / maintainer := "atala-coredid@iohk.io", Docker / dockerUsername := Some("input-output-hk"), Docker / dockerRepository := Some("ghcr.io"), + Docker / packageName := "atala-prism-mediator", dockerExposedPorts := Seq(8080), dockerBaseImage := "openjdk:11", ) diff --git a/docker-compose.yml b/docker-compose.yml index 91f0ddd6..12f3b4bf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,33 +12,28 @@ services: - MONGO_INITDB_DATABASE=mediator volumes: - ./initdb.js:/docker-entrypoint-initdb.d/initdb.js - # - ./:/opt/keyfile/ - # healthcheck: - # test: test $$(echo "rs.initiate().ok || rs.status().ok" | mongo -u $${MONGO_INITDB_ROOT_USERNAME} -p $${MONGO_INITDB_ROOT_PASSWORD} --quiet) -eq 1 - # interval: 10s - # start_period: 30s + atalaprism-mediator: - image: ghcr.io/input-output-hk/mediator:${MEDIATOR_VERSION:-0.2.0-SNAPSHOT} + image: ghcr.io/input-output-hk/atala-prism-mediator:${MEDIATOR_VERSION:-0.2.0-SNAPSHOT} ports: - 8080:8080 - network_mode: host #hash on mac remove this the default is bridge we can use host.docker.internal environment: - # Creates the identity: "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9rOHMtaW50LmF0YWxhcHJpc20uaW8vbWVkaWF0b3IiLCJyIjpbXSwiYSI6WyJkaWRjb21tL3YyIl19" + # Creates the identity: - KEY_AGREEMENT_D=Z6D8LduZgZ6LnrOHPrMTS6uU2u5Btsrk1SGs4fn8M7c - KEY_AGREEMENT_X=Sr4SkIskjN_VdKTn0zkjYbhGTWArdUNE4j_DmUpnQGw - KEY_AUTHENTICATION_D=INXCnxFEl0atLIIQYruHzGd5sUivMRyQOzu87qVerug - KEY_AUTHENTICATION_X=MBjnXZxkMcoQVVL21hahWAw43RuAG-i64ipbeKKqwoA - - SERVICE_ENDPOINT=https://k8s-int.atalaprism.io/mediator - # Config storage - #- DB_URL=mongodb://admin:admin@localhost:27017 +# - SERVICE_ENDPOINT=https://k8s-int.atalaprism.io/mediator - MONGODB_USER=admin - MONGODB_PASSWORD=admin - MONGODB_PROTOCOL=mongodb - - MONGODB_HOST=localhost + - MONGODB_HOST=mongo - MONGODB_PORT=27017 - MONGODB_DB_NAME=mediator depends_on: - "mongo" + extra_hosts: + - "host.docker.internal:host-gateway" # RUN diff --git a/tests/mediator-integration-tests/src/test/kotlin/abilities/HttpListener.kt b/tests/mediator-integration-tests/src/test/kotlin/abilities/HttpListener.kt index 87fffab6..07d3b238 100644 --- a/tests/mediator-integration-tests/src/test/kotlin/abilities/HttpListener.kt +++ b/tests/mediator-integration-tests/src/test/kotlin/abilities/HttpListener.kt @@ -20,7 +20,7 @@ object HttpListener { post("/") { val json = call.receiveText() receivedResponse = json - call.respond(HttpStatusCode.OK, "Data received") + call.respond(HttpStatusCode.OK) } } } @@ -35,7 +35,7 @@ object HttpListener { } fun endpoint(): String { - return "http://${Environments.RECIPIENT_LISTENER_HOST}:${Environments.RECIPIENT_LISTENER_PORT}" + return "http://host.docker.internal:${Environments.RECIPIENT_LISTENER_PORT}" } fun receivedResponse(): String? { diff --git a/tests/mediator-integration-tests/src/test/kotlin/common/Environments.kt b/tests/mediator-integration-tests/src/test/kotlin/common/Environments.kt index e2746e1b..af70c32f 100644 --- a/tests/mediator-integration-tests/src/test/kotlin/common/Environments.kt +++ b/tests/mediator-integration-tests/src/test/kotlin/common/Environments.kt @@ -3,7 +3,7 @@ package common import io.iohk.atala.prism.walletsdk.domain.models.DID object Environments { - val MEDIATOR_PEER_DID = DID(System.getenv("MEDIATOR_PEER_DID") ?: "did:peer:2.Ez6LSfKLqi2VZj2p84qE2AnHCv4YQtJoZXG7SmxoFGiqLuqa8.Vz6Mkf92NMfWKgLWYpGUfmsGiuEQfQSoLCuKDmFAhxQgkCUFY.SeyJ0IjoiZG0iLCJzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ") + val MEDIATOR_PEER_DID = DID(System.getenv("MEDIATOR_PEER_DID") ?: "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9tZWRpYXRvci10ZXN0LWVudi5hdGFsYXByaXNtLmlvL21lZGlhdG9yIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfQ") val MEDIATOR_URL = System.getenv("MEDIATOR_URL") ?: "http://localhost:8080" val RECIPIENT_LISTENER_HOST = System.getenv("RECIPIENT_LISTENER_URL") ?: "0.0.0.0" val RECIPIENT_LISTENER_PORT = (System.getenv("RECIPIENT_LISTENER_PORT") ?: "9999").toInt() diff --git a/tests/mediator-integration-tests/src/test/kotlin/features/mediation_coordination/MediationCoordinationSteps.kt b/tests/mediator-integration-tests/src/test/kotlin/features/mediation_coordination/MediationCoordinationSteps.kt index 52260e4f..b8633ee8 100644 --- a/tests/mediator-integration-tests/src/test/kotlin/features/mediation_coordination/MediationCoordinationSteps.kt +++ b/tests/mediator-integration-tests/src/test/kotlin/features/mediation_coordination/MediationCoordinationSteps.kt @@ -95,26 +95,28 @@ class MediationCoordinationSteps { @When("{actor} sends a keylist query message to the mediator") fun recipientSendsAKeylistQueryMessageToTheMediator(recipient: Actor) { - TODO("Not supported by the PRISM Mediator yet") -// val keylistUpdateMessage = Message( -// piuri = DidcommMessageTypes.MEDIATE_KEYLIST_QUERY, -// from = EdgeAgent.peerDID, -// to = Environments.MEDIATOR_PEER_DID, -// body = MediationKeylistQueryRequest( -// paginate = Paginate( -// limit = 2, -// offset = 0 -// ) -// ).toJsonString() -// ) -// recipient.attemptsTo( -// SendDidcommMessage(keylistUpdateMessage) -// ) + val keyListQueryMessage = Message( + piuri = DidcommMessageTypes.MEDIATE_KEYLIST_QUERY, + from = EdgeAgent.peerDID, + to = Environments.MEDIATOR_PEER_DID, + body = MediationKeylistQueryRequest( + paginate = Paginate( + limit = 2, + offset = 0 + ) + ).toJsonString() + ) + recipient.attemptsTo( + SendDidcommMessage(keyListQueryMessage) + ) } @Then("Mediator responds to {actor} with keylist message containing the current list of keys") fun mediatorRespondsToRecipientWithKeylistMessageContainingTheCurrentListOfKeys(recipient: Actor) { - TODO("Not supported by the PRISM Mediator yet") + val didcommMessage = EdgeAgent.unpackLastDidcommMessage() + recipient.attemptsTo( + Ensure.that(didcommMessage.piuri).isEqualTo(DidcommMessageTypes.MEDIATE_KEYLIST_RESPONSE) + ) } @When("{actor} sends a keylist update message to the mediator to remove the last alias") diff --git a/tests/mediator-integration-tests/src/test/kotlin/features/ping/PingProtocolSteps.kt b/tests/mediator-integration-tests/src/test/kotlin/features/ping/PingProtocolSteps.kt index 6d552b2e..e76bdec1 100644 --- a/tests/mediator-integration-tests/src/test/kotlin/features/ping/PingProtocolSteps.kt +++ b/tests/mediator-integration-tests/src/test/kotlin/features/ping/PingProtocolSteps.kt @@ -32,9 +32,6 @@ class PingProtocolSteps { @Then("{actor} gets trusted ping message back") fun recipientGetTrustedPingMessageBack(recipient: Actor) { - - println(HttpListener.receivedResponse()!!) - val didcommResponse: Message = EdgeAgent.unpackMessage( HttpListener.receivedResponse()!! ) diff --git a/tests/mediator-integration-tests/src/test/resources/features/mediation_coordination/mediation_coordination.feature b/tests/mediator-integration-tests/src/test/resources/features/mediation_coordination/mediation_coordination.feature index 56298a2b..c9e0b233 100644 --- a/tests/mediator-integration-tests/src/test/resources/features/mediation_coordination/mediation_coordination.feature +++ b/tests/mediator-integration-tests/src/test/resources/features/mediation_coordination/mediation_coordination.feature @@ -4,8 +4,6 @@ Scenario: Successful Mediation Request When Recipient sends a mediate request message to the mediator Then Mediator responds to Recipient with mediate grant message -# BUG: field should be called recipient_did instead of routing_did, Fabio to fix soon -# https://input-output.atlassian.net/browse/ATL-4845 Scenario: Recipient adds new key to keylist Given Recipient successfully set up a connection with the mediator When Recipient sends a keylist update message to the mediator with a new peer did @@ -17,22 +15,17 @@ Scenario: Recipient removes alias from keylist When Recipient sends a keylist update message to the mediator to remove added alias Then Mediator responds to Recipient with a correct keylist update remove message -# BUG: server-error is returned, lets change to no_change -# https://input-output.atlassian.net/browse/ATL-4847 Scenario: Recipient removes not existing alias Given Recipient successfully set up a connection with the mediator When Recipient sends a keylist update message to the mediator to remove not existing alias Then Mediator responds to Recipient with a message with no_change status -# https://input-output.atlassian.net/browse/ATL-4848 -# https://input-output.atlassian.net/browse/ATL-5020 -@BUG_ATL-5020 Scenario: Recipient removes the last alias from keylist Given Recipient successfully set up a connection with the mediator When Recipient sends a keylist update message to the mediator to remove the last alias Then Mediator responds to Recipient with a correct keylist update remove message -# NOT IMPLEMENTED YET +# NOT SUPPORTED YET #Scenario: Recipient query keylist # Given Recipient successfully set up a connection with the mediator # When Recipient sends a keylist query message to the mediator