Initial setup work for system tests
This commit is contained in:
8
tests/WebApi.Tests.System/Dockerfile.keycloak
Normal file
8
tests/WebApi.Tests.System/Dockerfile.keycloak
Normal 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 /
|
||||
23
tests/WebApi.Tests.System/WebApi.Tests.System.csproj
Normal file
23
tests/WebApi.Tests.System/WebApi.Tests.System.csproj
Normal 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>
|
||||
69
tests/WebApi.Tests.System/compose.system.yaml
Normal file
69
tests/WebApi.Tests.System/compose.system.yaml
Normal 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
|
||||
2332
tests/WebApi.Tests.System/test-realm.json
Normal file
2332
tests/WebApi.Tests.System/test-realm.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user