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: run testcontainer #128

Merged
merged 1 commit into from
Feb 15, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Build with Gradle
timeout-minutes: 15
run: |
./gradlew build -x test --scan
./gradlew build --scan
working-directory: ${{ matrix.module }}

build-frontend:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ public abstract class TestcontainersConfigs {
static void beforeAll() {
postgres.start();
idP.withExposedPorts(8180)
.waitingFor(Wait.forHttp("/realms/greenbuildings/.well-known/openid-configuration")
.forStatusCode(200)
.withReadTimeout(java.time.Duration.ofMinutes(5))
.withStartupTimeout(java.time.Duration.ofMinutes(5))
)
.start();
.withCommand("start-dev --http-port 8180")
.waitingFor(Wait.forHttp("/realms/greenbuildings/.well-known/openid-configuration"))
.start();
}

@AfterAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void getEnterpriseBuildings_withValidToken_returns200() {
.contentType(ContentType.JSON)
.body(new SearchCriteriaDTO<Void>(null, null, null))
.when()
.post("/buildings/search")
.post("/api/buildings/search")
.then()
.statusCode(200);
}
Expand All @@ -42,7 +42,7 @@ void getEnterpriseBuildings_withInvalidToken_returns401() {
.contentType(ContentType.JSON)
.body(new SearchCriteriaDTO<Void>(null, null, null))
.when()
.post("/buildings/search")
.post("/api/buildings/search")
.then()
.statusCode(401);
}
Expand All @@ -59,7 +59,7 @@ void createBuilding_withValidToken_returns201() {
.contentType(ContentType.JSON)
.body(building)
.when()
.post("/buildings")
.post("/api/buildings")
.then()
.statusCode(201);
}
Expand All @@ -71,7 +71,7 @@ void createBuilding_withMissingFields_returns400() {
.contentType(ContentType.JSON)
.body(BuildingDTO.builder().build())
.when()
.post("/buildings")
.post("/api/buildings")
.then()
.statusCode(400);
}
Expand All @@ -83,7 +83,7 @@ void createBuilding_withInvalidToken_returns401() {
.contentType(ContentType.JSON)
.body(BuildingDTO.builder().build())
.when()
.post("/buildings")
.post("/api/buildings")
.then()
.statusCode(401);
}
Expand Down
4 changes: 2 additions & 2 deletions sep490-infrastructure/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
sep490_instance:
sep490_databases:
image: postgres:16.4
container_name: sep490_instance
container_name: sep490_databases
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM quay.io/keycloak/keycloak:24.0.5

USER 0
COPY ./greenbuildings.json /tmp
COPY ./target/greenbuildings-testcontainer-plugin.jar /opt/keycloak/providers
RUN /opt/keycloak/bin/kc.sh build --health-enabled=true
RUN /opt/keycloak/bin/kc.sh import --file /tmp/greenbuildings.json
10 changes: 10 additions & 0 deletions sep490-infrastructure/keycloak-testcontainer-provider/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
podman manifest rm thongdh3401/keycloak:24.0.5

# First, initialise the manifest
podman manifest create thongdh3401/keycloak:24.0.5

# Build the image attaching them to the manifest
podman build --platform linux/amd64,linux/arm64 --manifest thongdh3401/keycloak:24.0.5 .

# Finally publish the manifest
podman manifest push thongdh3401/keycloak:24.0.5
Loading