Skip to content

Commit 61dea38

Browse files
committed
feat(container): add ThirdParty provider localization and tests
- Standardize ThirdParty provider logging with i18n (10 languages) - Add 11 unit tests with MockV1Server using dynamic ports - Remove deprecated Docker Swarm resource strings - Update documentation to reflect current container providers
1 parent 57a659d commit 61dea38

17 files changed

Lines changed: 687 additions & 21 deletions

.github/copilot-instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ GZ::CTF is a full‑stack, production‑ready CTF platform for competitions and
2323
- Rate limiting: Global sliding window + named policies (`Middlewares/RateLimiter.cs`), disabled by `DisableRateLimit=true`.
2424
- i18n: `Resources/` with `IStringLocalizer<Program>`; invalid model state returns JSON via `InvalidModelStateHandler`.
2525
- SignalR patterns: Strongly-typed hubs (`AdminHub`, `MonitorHub`, `UserHub`) with client interfaces (`IAdminClient`, `IMonitorClient`, `IUserClient`) for real-time notifications. Each hub validates permissions and groups clients by game ID.
26-
- Container proxy: `ProxyController` handles TCP-over-WebSocket for challenge access when `ContainerPortMappingType.PlatformProxy` is set. Supports Docker Swarm and Kubernetes with traffic capture capabilities.
26+
- Container proxy: `ProxyController` handles TCP-over-WebSocket for challenge access when `ContainerPortMappingType.PlatformProxy` is set. Supports Kubernetes with traffic capture capabilities.
2727
- Frontend `src/GZCTF/ClientApp` (React + Mantine + Vite):
2828
- Dev server on `63000` with proxy to backend; configure backend URL via `VITE_BACKEND_URL` (defaults to `http://localhost:8080`) in `vite.config.mts`.
2929
- Build outputs to `ClientApp/build` and is copied to backend `wwwroot` during `dotnet publish`.
@@ -74,7 +74,7 @@ Design notes (flexibility vs performance)
7474
- Storage connection string prefixes: `disk://` (forced default), `aws.s3://`, `minio.s3://`, `azure.blobs://`. Self-maintenance storage ensures blob cleanup and consistency.
7575
- Environment configuration prefix: `GZCTF_` (env vars override config).
7676
- Role hierarchy: `Admin` (3) > `Monitor` (1) > `User` (0) > `Banned` (-1). Frontend `WithRole` component uses `RoleMap` for access control.
77-
- Container management: Docker Swarm (`SwarmManager`) and Kubernetes (`KubernetesManager`) support with K3s/MinIO integration. Use `IContainerManager` interface for consistency.
77+
- Container management: Docker (`DockerManager`) and Kubernetes (`KubernetesManager`) support with K3s/MinIO integration. Use `IContainerManager` interface for consistency.
7878
- Task Status: Enum includes `Success`, `Failed`, `Pending`, `Running`, `Unhealthy`, `Degraded` statuses for container/service health.
7979
- Divisions API: Endpoints for game-scoped division management with challenge configs. Division affects challenge visibility, scoring, and deadline enforcement.
8080
- FirstSolves tracking: Separate table for first-blood metadata (team, user, timestamp); used for bonus scoring and statistics.
@@ -100,7 +100,7 @@ Design notes (flexibility vs performance)
100100
- `dotnet test src/GZCTF.Integration.Test/GZCTF.Integration.Test.csproj -v minimal /p:CollectCoverage=true` (requires Docker; uses Testcontainers for K3s, MinIO, PostgreSQL)
101101
- Testing framework:
102102
- Unit tests: xUnit with `IRepository<T>` and service mocking; examples in `GZCTF.Test/UnitTests/`.
103-
- Integration tests: Testcontainers for Docker Swarm/Kubernetes, MinIO S3, PostgreSQL, Redis; examples in `GZCTF.Integration.Test/Tests/`. Covers dynamic container challenges, flag retrieval, storage operations, and repository data validation.
103+
- Integration tests: Testcontainers for Docker/Kubernetes, MinIO S3, PostgreSQL, Redis; examples in `GZCTF.Integration.Test/Tests/`. Covers dynamic container challenges, flag retrieval, storage operations, and repository data validation.
104104
- EF Core migrations (PostgreSQL):
105105
- `dotnet ef migrations add <Name> --project src/GZCTF/GZCTF.csproj --startup-project src/GZCTF/GZCTF.csproj`
106106
- `dotnet ef database update`
@@ -120,7 +120,7 @@ Design notes (flexibility vs performance)
120120
## Container management
121121

122122
- Port mapping types: `Default` (random host ports) vs `PlatformProxy` (TCP-over-WebSocket).
123-
- Container providers: Docker Swarm (`SwarmManager`) and Kubernetes (`KubernetesManager`) with `IContainerManager` abstraction.
123+
- Container providers: Docker (`DockerManager`) and Kubernetes (`KubernetesManager`) with `IContainerManager` abstraction.
124124
- Traffic capture: Optional recording of container network traffic to storage when `EnableTrafficCapture=true`.
125125
- Challenge types: Static/Dynamic containers with environment variable flag injection.
126126
- Resource management: Automatic cleanup and scaling based on team participation.

src/GZCTF.Integration.Test/Tests/Api/ScoreboardCalculationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,8 @@ private ScoreboardSnapshot(
14091409
BloodBonusValue = bloodBonusValue;
14101410
ChallengeCount = challengeCount;
14111411
Teams = teams;
1412-
this._teamMap = teamMap;
1413-
this._challengeMap = challengeMap;
1412+
_teamMap = teamMap;
1413+
_challengeMap = challengeMap;
14141414
Divisions = divisions;
14151415
Timelines = timelines;
14161416
}

0 commit comments

Comments
 (0)