diff --git a/tests/integration-tests/README.md b/tests/integration-tests/README.md index 2fef57bf71..4b0e925bcd 100644 --- a/tests/integration-tests/README.md +++ b/tests/integration-tests/README.md @@ -116,10 +116,6 @@ The configuration files are divided into the following sections: * `agents`: contains the configuration for the agents (ICA) that will be started. By default, all agents will be destroyed after the test run is finished. * `roles`: contains the configuration for the roles (Issuer, Holder, Verifier, Admin). A role can be assigned to one or more agents that we set in `agents` section or already running locally or in the cloud. -> You could keep services and agents running for debugging purposes -> by specifying `keep_running = true` for the service or agent -> in the configuration file and setting `TESTCONTAINERS_RYUK_DISABLED` variable to `true`. - Please, check [test/resources/configs/basic.conf](./src/test/resources/configs/basic.conf) for a quick example of a basic configuration. You could explore the `configs` directory for more complex examples. diff --git a/tests/integration-tests/src/test/kotlin/config/services/Agent.kt b/tests/integration-tests/src/test/kotlin/config/services/Agent.kt index f4d7cc0962..2332d7ee6d 100644 --- a/tests/integration-tests/src/test/kotlin/config/services/Agent.kt +++ b/tests/integration-tests/src/test/kotlin/config/services/Agent.kt @@ -3,6 +3,7 @@ package config.services import com.sksamuel.hoplite.ConfigAlias import config.VaultAuthType import org.testcontainers.containers.ComposeContainer +import org.testcontainers.containers.GenericContainer import org.testcontainers.containers.wait.strategy.Wait import java.io.* @@ -16,7 +17,6 @@ data class Agent( @ConfigAlias("prism_node") val prismNode: VerifiableDataRegistry?, val keycloak: Keycloak?, val vault: Vault?, - @ConfigAlias("keep_running") override val keepRunning: Boolean = false, ) : ServiceBase() { override val logServices = listOf("identus-cloud-agent") diff --git a/tests/integration-tests/src/test/kotlin/config/services/Keycloak.kt b/tests/integration-tests/src/test/kotlin/config/services/Keycloak.kt index d73a8814b5..86027fe3ad 100644 --- a/tests/integration-tests/src/test/kotlin/config/services/Keycloak.kt +++ b/tests/integration-tests/src/test/kotlin/config/services/Keycloak.kt @@ -17,7 +17,6 @@ data class Keycloak( val realm: String = "atala-demo", @ConfigAlias("client_id") val clientId: String = "cloud-agent", @ConfigAlias("client_secret") val clientSecret: String = "cloud-agent-secret", - @ConfigAlias("keep_running") override val keepRunning: Boolean = false, @ConfigAlias("compose_file") val keycloakComposeFile: String = "src/test/resources/containers/keycloak.yml", @ConfigAlias("logger_name") val loggerName: String = "keycloak", @ConfigAlias("extra_envs") val extraEnvs: Map = emptyMap(), diff --git a/tests/integration-tests/src/test/kotlin/config/services/ServiceBase.kt b/tests/integration-tests/src/test/kotlin/config/services/ServiceBase.kt index 8c598b61d6..9c2483084a 100644 --- a/tests/integration-tests/src/test/kotlin/config/services/ServiceBase.kt +++ b/tests/integration-tests/src/test/kotlin/config/services/ServiceBase.kt @@ -15,7 +15,6 @@ abstract class ServiceBase : Startable { } abstract val container: ComposeContainer - abstract val keepRunning: Boolean open val logServices: List = emptyList() private val logWriters: MutableList = mutableListOf() @@ -41,8 +40,6 @@ abstract class ServiceBase : Startable { logWriters.forEach { it.close() } - if (!keepRunning) { - container.stop() - } + container.stop() } } diff --git a/tests/integration-tests/src/test/kotlin/config/services/Vault.kt b/tests/integration-tests/src/test/kotlin/config/services/Vault.kt index 85f1a02b27..a14a44620b 100644 --- a/tests/integration-tests/src/test/kotlin/config/services/Vault.kt +++ b/tests/integration-tests/src/test/kotlin/config/services/Vault.kt @@ -14,7 +14,6 @@ import java.io.File data class Vault( @ConfigAlias("http_port") val httpPort: Int, @ConfigAlias("vault_auth_type") val authType: VaultAuthType = VaultAuthType.APP_ROLE, - @ConfigAlias("keep_running") override val keepRunning: Boolean = false, ) : ServiceBase() { private val logger = Logger.get() override val logServices: List = listOf("vault") diff --git a/tests/integration-tests/src/test/kotlin/config/services/VerifiableDataRegistry.kt b/tests/integration-tests/src/test/kotlin/config/services/VerifiableDataRegistry.kt index 2997f567cc..f4fbcdba66 100644 --- a/tests/integration-tests/src/test/kotlin/config/services/VerifiableDataRegistry.kt +++ b/tests/integration-tests/src/test/kotlin/config/services/VerifiableDataRegistry.kt @@ -8,7 +8,6 @@ import java.io.File data class VerifiableDataRegistry( @ConfigAlias("http_port") val httpPort: Int, val version: String, - @ConfigAlias("keep_running") override val keepRunning: Boolean = false, ) : ServiceBase() { override val logServices: List = listOf("prism-node") private val vdrComposeFile = "src/test/resources/containers/vdr.yml" diff --git a/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt b/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt index 3cd1873033..6a2e906361 100644 --- a/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/oid4vci/IssueCredentialSteps.kt @@ -5,6 +5,7 @@ import com.nimbusds.jose.JWSAlgorithm import com.nimbusds.jose.jwk.JWK import eu.europa.ec.eudi.openid4vci.* import interactions.Post +import interactions.body import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get @@ -40,16 +41,13 @@ class IssueCredentialSteps { issuer.recall("longFormDid") } issuer.attemptsTo( - Post.to("/oid4vci/issuers/${credentialIssuer.id}/credential-offers") - .with { - it.body( - CredentialOfferRequest( - credentialConfigurationId = configurationId, - issuingDID = did, - claims = claims, - ), - ) - }, + Post.to("/oid4vci/issuers/${credentialIssuer.id}/credential-offers").body( + CredentialOfferRequest( + credentialConfigurationId = configurationId, + issuingDID = did, + claims = claims, + ), + ), Ensure.thatTheLastResponse().statusCode().isEqualTo(HttpStatus.SC_CREATED), ) val offerUri = SerenityRest.lastResponse().get().credentialOffer diff --git a/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageIssuerSteps.kt b/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageIssuerSteps.kt index 7db69f0b41..779d731e2a 100644 --- a/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageIssuerSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/oid4vci/ManageIssuerSteps.kt @@ -1,7 +1,12 @@ package steps.oid4vci -import interactions.* -import io.cucumber.java.en.* +import interactions.Delete +import interactions.Get +import interactions.Patch +import interactions.Post +import io.cucumber.java.en.Given +import io.cucumber.java.en.Then +import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get import io.iohk.atala.automation.serenity.ensure.Ensure import net.serenitybdd.rest.SerenityRest @@ -9,7 +14,14 @@ import net.serenitybdd.screenplay.Actor import org.apache.http.HttpStatus import org.apache.http.HttpStatus.SC_CREATED import org.apache.http.HttpStatus.SC_OK -import org.hyperledger.identus.client.models.* +import org.hyperledger.identus.client.models.AuthorizationServer +import org.hyperledger.identus.client.models.CreateCredentialIssuerRequest +import org.hyperledger.identus.client.models.CredentialIssuer +import org.hyperledger.identus.client.models.CredentialIssuer1 +import org.hyperledger.identus.client.models.CredentialIssuerPage +import org.hyperledger.identus.client.models.IssuerMetadata +import org.hyperledger.identus.client.models.PatchAuthorizationServer +import org.hyperledger.identus.client.models.PatchCredentialIssuerRequest class ManageIssuerSteps { private val UPDATE_AUTH_SERVER_URL = "http://example.com" @@ -44,7 +56,7 @@ class ManageIssuerSteps { @Then("{actor} sees the oid4vci issuer exists on the agent") fun issuerSeesCredentialIssuerExists(issuer: Actor) { - val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") + val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") issuer.attemptsTo( Get("/oid4vci/issuers"), Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), @@ -94,9 +106,26 @@ class ManageIssuerSteps { ) } + @When("{actor} tries to create oid4vci issuer with '{}', '{}', '{}' and '{}'") + fun issuerTriesToCreateOIDCIssuer( + issuer: Actor, + id: String?, + url: String?, + clientId: String?, + clientSecret: String? + ) { + println("$issuer $id $url $clientId $clientSecret") + println(url == null) + } + + @Then("{actor} should see the oid4vci error '{}'") + fun issuerShouldSeeTheOIDC4VCIError(issuer: Actor, error: String) { + + } + @Then("{actor} sees the oid4vci issuer updated with new values") fun issuerSeesUpdatedCredentialIssuer(issuer: Actor) { - val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") + val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") issuer.attemptsTo( Get("/oid4vci/issuers"), Ensure.thatTheLastResponse().statusCode().isEqualTo(HttpStatus.SC_OK), @@ -123,7 +152,7 @@ class ManageIssuerSteps { @Then("{actor} cannot see the oid4vci issuer on the agent") fun issuerCannotSeeCredentialIssuer(issuer: Actor) { - val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") + val credentialIssuer = issuer.recall("oid4vciCredentialIssuer") issuer.attemptsTo( Get("/oid4vci/issuers"), Ensure.thatTheLastResponse().statusCode().isEqualTo(HttpStatus.SC_OK), diff --git a/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature b/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature index d2b6bd4aa6..58a52814ee 100644 --- a/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature +++ b/tests/integration-tests/src/test/resources/features/oid4vci/manage_issuer.feature @@ -1,19 +1,30 @@ @oid4vci Feature: Manage OID4VCI credential issuer -Scenario: Successfully create credential issuer + Scenario: Successfully create credential issuer When Issuer creates an oid4vci issuer Then Issuer sees the oid4vci issuer exists on the agent And Issuer sees the oid4vci issuer on IssuerMetadata endpoint -Scenario: Successfully update credential issuer + Scenario: Successfully update credential issuer Given Issuer has an existing oid4vci issuer When Issuer updates the oid4vci issuer Then Issuer sees the oid4vci issuer updated with new values And Issuer sees the oid4vci IssuerMetadata endpoint updated with new values -Scenario: Successfully delete credential issuer + Scenario: Successfully delete credential issuer Given Issuer has an existing oid4vci issuer When Issuer deletes the oid4vci issuer Then Issuer cannot see the oid4vci issuer on the agent And Issuer cannot see the oid4vci IssuerMetadata endpoint + + @test + Scenario Outline: Create issuer with wrong data should not work + When Issuer tries to create oid4vci issuer with '', '', '' and '' + Then Issuer should see the oid4vci error '' + Examples: + | id | url | clientId | clientSecret | error | + | null | null | null | null | | + | | | | | | + | empty | empty | empty | empty | | + | 1 | {} | null | null | |