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
@@ -16,7 +16,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{437DE053
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi.Tests.Unit", "tests\WebApi.Tests.Unit\WebApi.Tests.Unit.csproj", "{5BA94D65-1D04-49EA-B7CC-F3719DE2D97E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi.Tests.Integration", "tests\WebApi.Tests.Integration\WebApi.Tests.Integration.csproj", "{0B1F3D81-95E8-4CFC-8A90-8A3CB2549326}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi.Tests.Integration", "tests\WebApi.Tests.Integration\WebApi.Tests.Integration.csproj", "{0B1F3D81-95E8-4CFC-8A90-8A3CB2549326}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi.Tests.System", "tests\WebApi.Tests.System\WebApi.Tests.System.csproj", "{21418359-4A20-4F4A-B26C-A75A2B70AA10}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -36,6 +38,10 @@ Global
|
||||
{0B1F3D81-95E8-4CFC-8A90-8A3CB2549326}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0B1F3D81-95E8-4CFC-8A90-8A3CB2549326}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0B1F3D81-95E8-4CFC-8A90-8A3CB2549326}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{21418359-4A20-4F4A-B26C-A75A2B70AA10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{21418359-4A20-4F4A-B26C-A75A2B70AA10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{21418359-4A20-4F4A-B26C-A75A2B70AA10}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{21418359-4A20-4F4A-B26C-A75A2B70AA10}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -44,6 +50,7 @@ Global
|
||||
{9FF3C98A-5085-4EBE-A980-DB2148B0C00A} = {C051A684-BD6A-43F2-B0CC-F3C2315D99E3}
|
||||
{5BA94D65-1D04-49EA-B7CC-F3719DE2D97E} = {437DE053-1DAB-4EEF-BEA6-E3B5179692F8}
|
||||
{0B1F3D81-95E8-4CFC-8A90-8A3CB2549326} = {437DE053-1DAB-4EEF-BEA6-E3B5179692F8}
|
||||
{21418359-4A20-4F4A-B26C-A75A2B70AA10} = {437DE053-1DAB-4EEF-BEA6-E3B5179692F8}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7813E32D-AE19-479C-853B-063882D2D05A}
|
||||
|
||||
Reference in New Issue
Block a user