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

feat: use E2E tests for BOM Smoke tests #478

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
13 changes: 0 additions & 13 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,3 @@ jobs:
if: github.event_name == 'pull_request'
uses: eclipse-edc/.github/.github/workflows/verify-openapi.yml@main
secrets: inherit

Verify-IH-BOM:
strategy:
fail-fast: false

# we can't test the "controlplane-oauth2-com" because it only starts successfully if the public key is already in the vault
matrix:
bom-directory: [ "dist/bom/identityhub-bom",
"dist/bom/identityhub-with-sts-bom" ]
uses: eclipse-edc/.github/.github/workflows/verify-bom.yml@main
with:
module-dir: ${{ matrix.bom-directory }}
properties-file: example.properties
10 changes: 0 additions & 10 deletions dist/bom/identityhub-bom/example.properties

This file was deleted.

13 changes: 0 additions & 13 deletions dist/bom/identityhub-with-sts-bom/example.properties

This file was deleted.

28 changes: 28 additions & 0 deletions e2e-tests/bom-tests/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
*
*/

plugins {
java
}

dependencies {
testImplementation(libs.edc.junit)
testImplementation(libs.restAssured)
testImplementation(libs.assertj)
testImplementation(libs.awaitility)
}

edcBuild {
publish.set(false)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
*
*/

package org.eclipse.edc.test.bom;


import org.eclipse.edc.junit.annotations.EndToEndTest;
import org.eclipse.edc.junit.extensions.EmbeddedRuntime;
import org.eclipse.edc.junit.extensions.RuntimeExtension;
import org.eclipse.edc.junit.extensions.RuntimePerMethodExtension;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.util.HashMap;
import java.util.Map;

import static io.restassured.RestAssured.given;
import static java.lang.String.valueOf;
import static org.awaitility.Awaitility.await;
import static org.eclipse.edc.util.io.Ports.getFreePort;
import static org.hamcrest.Matchers.equalTo;


public class BomSmokeTests {
abstract static class SmokeTest {
public static final String DEFAULT_PORT = "8080";
public static final String DEFAULT_PATH = "/api";

@Test
void assertRuntimeReady() {
await().untilAsserted(() -> given()
.baseUri("http://localhost:" + DEFAULT_PORT + DEFAULT_PATH + "/check/startup")
.get()
.then()
.statusCode(200)
.log().ifValidationFails()
.body("isSystemHealthy", equalTo(true)));

}
}

@Nested
@EndToEndTest
class IdentityHub extends SmokeTest {

@RegisterExtension
protected RuntimeExtension runtime =
new RuntimePerMethodExtension(new EmbeddedRuntime("identityhub-bom",
Map.of(
"web.http.port", DEFAULT_PORT,
"web.http.path", DEFAULT_PATH,
"edc.ih.iam.id", "did:web:test",
"edc.ih.iam.publickey.path", "/some/path/to/key.pem",
"web.http.presentation.port", valueOf(getFreePort()),
"web.http.presentation.path", "/api/resolution",
"web.http.identity.port", valueOf(getFreePort()),
"web.http.identity.path", "/api/identity",
"edc.sts.account.api.url", "https://sts.com/accounts",
"edc.sts.accounts.api.auth.header.value", "password"),
":dist:bom:identityhub-bom"
));
}

@Nested
@EndToEndTest
class IdentityHubWithSts extends SmokeTest {

@RegisterExtension
protected RuntimeExtension runtime =
new RuntimePerMethodExtension(new EmbeddedRuntime("identityhub-with-sts-bom",
new HashMap<>() {
{
put("web.http.port", DEFAULT_PORT);
put("web.http.path", DEFAULT_PATH);
put("edc.ih.iam.id", "did:web:test");
put("edc.ih.iam.publickey.path", "/some/path/to/key.pem");
put("web.http.presentation.port", valueOf(getFreePort()));
put("web.http.presentation.path", "/api/resolution");
put("web.http.identity.port", valueOf(getFreePort()));
put("web.http.identity.path", "/api/identity");
put("web.http.accounts.port", valueOf(getFreePort()));
put("web.http.accounts.path", "/api/accounts");
put("edc.api.accounts.key", "password");
}
},
":dist:bom:identityhub-with-sts-bom"
));
}
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ include(":e2e-tests:api-tests")
include(":e2e-tests:sts-tests")
include(":e2e-tests:runtimes:identityhub-remote-sts")
include(":e2e-tests:runtimes:sts")
include(":e2e-tests:bom-tests")

// BOM modules
include(":dist:bom:identityhub-base-bom")
Expand Down
Loading