Files
admin/_docs/02_document/tests/environment.md
T
2026-04-16 06:25:36 +03:00

3.2 KiB

Test Environment

Overview

System under test: Azaion Admin API — ASP.NET Core Minimal API at http://localhost:8080 Consumer app purpose: Standalone xUnit test project exercising the API through HTTP requests, validating black-box use cases without access to internals.

Docker Environment

Services

Service Image / Build Purpose Ports
system-under-test Build from Dockerfile Azaion Admin API 8080:8080
test-db postgres:16-alpine PostgreSQL database 4312:5432
e2e-consumer Build from docker.test/Dockerfile Black-box test runner (xUnit)

Networks

Network Services Purpose
e2e-net all Isolated test network

Volumes

Volume Mounted to Purpose
test-resources system-under-test:/app/Content Resource files for upload/download tests
db-init test-db:/docker-entrypoint-initdb.d Schema DDL + seed data

docker-compose structure

services:
  test-db:
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: azaion
      POSTGRES_USER: azaion_superadmin
      POSTGRES_PASSWORD: test_password
    volumes:
      - ./env/db/01_permissions.sql:/docker-entrypoint-initdb.d/01.sql
      - ./env/db/02_structure.sql:/docker-entrypoint-initdb.d/02.sql
      - ./env/db/03_add_timestamp_columns.sql:/docker-entrypoint-initdb.d/03.sql
    networks:
      - e2e-net

  system-under-test:
    build: .
    environment:
      ASPNETCORE_ConnectionStrings__AzaionDb: "Host=test-db;Port=5432;Database=azaion;Username=azaion_reader;Password=test_password"
      ASPNETCORE_ConnectionStrings__AzaionDbAdmin: "Host=test-db;Port=5432;Database=azaion;Username=azaion_admin;Password=test_password"
      ASPNETCORE_JwtConfig__Secret: "test-jwt-secret-key-at-least-32-chars-long"
      ASPNETCORE_ENVIRONMENT: Development
    depends_on:
      - test-db
    networks:
      - e2e-net

  e2e-consumer:
    build:
      context: .
      dockerfile: docker.test/Dockerfile
    environment:
      API_BASE_URL: "http://system-under-test:8080"
    depends_on:
      - system-under-test
    networks:
      - e2e-net

networks:
  e2e-net:

Consumer Application

Tech stack: C# / .NET 10.0, xUnit 2.9.2, FluentAssertions 6.12.2, HttpClient Entry point: dotnet test in the e2e consumer project

Communication with system under test

Interface Protocol Endpoint Authentication
REST API HTTP http://system-under-test:8080/* JWT Bearer token

What the consumer does NOT have access to

  • No direct database access to the test-db (queries go through the API only)
  • No internal module imports from Azaion.Services or Azaion.Common
  • No shared filesystem with the system-under-test (except via API upload/download)

CI/CD Integration

When to run: On every push to dev, main, and stage branches Pipeline stage: After build, before deploy Gate behavior: Block merge on failure Timeout: 5 minutes

Reporting

Format: CSV Columns: Test ID, Test Name, Execution Time (ms), Result (PASS/FAIL/SKIP), Error Message (if FAIL) Output path: ./e2e-results/report.csv