Initial setup work for system tests

This commit is contained in:
ThompsonNye
2024-08-04 16:46:43 +02:00
parent 5aaacbe3b1
commit 1555144f03
5 changed files with 2440 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
FROM registry.access.redhat.com/ubi9 AS ubi-micro-build
RUN mkdir -p /mnt/rootfs
RUN dnf install --installroot /mnt/rootfs curl --releasever 9 --setopt install_weak_deps=false --nodocs -y && \
dnf --installroot /mnt/rootfs clean all && \
rpm --root /mnt/rootfs -e --nodeps setup
FROM quay.io/keycloak/keycloak
COPY --from=ubi-micro-build /mnt/rootfs /

View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,69 @@
services:
app:
build: ../../src/WebApi
environment:
Vegasco_ConnectionStrings__Default: "Host=db;Port=5432;Database=postgres;Username=postgres;Password=postgres"
Vegasco_JWT__Issuer:
Vegasco_JWT__Authority:
Vegasco_JWT__Audience:
depends_on:
db:
condition: service_healthy
login:
condition: service_healthy
db:
image: postgres:16.3-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: pg_isready -d postgres
interval: 5s
timeout: 2s
retries: 3
start_period: 5s
login:
build:
context: .
dockerfile: Dockerfile.keycloak
command: start --import-realm
environment:
KC_DB: postgres
KC_DB_URL_HOST: login-db
KC_DB_URL_PORT: 5432
KC_DB_URL_DATABASE: keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: keycloak
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin1!
KC_HOSTNAME: http://localhost:12345/
KC_HEALTH_ENABLED: true
KC_METRICS_ENABLED: true
KC_HTTP_ENABLED: true
ports:
- 12345:8080
volumes:
- ./test-realm.json:/opt/keycloak/data/import/realm.json:ro
depends_on:
login-db:
condition: service_healthy
healthcheck:
test: curl --head -fsS http://localhost:9000/health/ready || exit 1
interval: 5s
timeout: 2s
retries: 6
start_period: 5s
login-db:
image: postgres:16-alpine
environment:
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
healthcheck:
test: pg_isready -d keycloak
interval: 5s
timeout: 2s
retries: 3
start_period: 5s

File diff suppressed because it is too large Load Diff