Add unit tests for Router configuration and transport layers
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled

- Implemented tests for RouterConfig, RoutingOptions, StaticInstanceConfig, and RouterConfigOptions to ensure default values are set correctly.
- Added tests for RouterConfigProvider to validate configurations and ensure defaults are returned when no file is specified.
- Created tests for ConfigValidationResult to check success and error scenarios.
- Developed tests for ServiceCollectionExtensions to verify service registration for RouterConfig.
- Introduced UdpTransportTests to validate serialization, connection, request-response, and error handling in UDP transport.
- Added scripts for signing authority gaps and hashing DevPortal SDK snippets.
This commit is contained in:
StellaOps Bot
2025-12-05 08:01:47 +02:00
parent 635c70e828
commit 6a299d231f
294 changed files with 28434 additions and 1329 deletions

View File

@@ -2,8 +2,8 @@
**Sprint:** 3
**Duration:** 1 sprint
**Status:** TODO
**Dependencies:** Phase 0 (Foundations)
**Status:** DOING (fresh-start approved; Mongo backfill skipped)
**Dependencies:** Phase 0 (Foundations) — DONE
---
@@ -14,6 +14,7 @@
3. Implement 7+ repository interfaces
4. Replace MongoDB job tracking with PostgreSQL
5. Implement PostgreSQL advisory locks for distributed locking
6. Backfill Mongo data or explicitly decide on fresh-start (PG-T2.9T2.11)
---
@@ -52,36 +53,36 @@ See [SPECIFICATION.md](../SPECIFICATION.md) Section 5.4 for complete Scheduler s
### T2.1: Create Scheduler.Storage.Postgres Project
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 0.5 days
**Subtasks:**
- [ ] T2.1.1: Create project structure
- [ ] T2.1.2: Add NuGet references
- [ ] T2.1.3: Create `SchedulerDataSource` class
- [ ] T2.1.4: Create `ServiceCollectionExtensions.cs`
- [x] T2.1.1: Create project structure
- [x] T2.1.2: Add NuGet references
- [x] T2.1.3: Create `SchedulerDataSource` class
- [x] T2.1.4: Create `ServiceCollectionExtensions.cs`
---
### T2.2: Implement Schema Migrations
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 1 day
**Subtasks:**
- [ ] T2.2.1: Create `V001_CreateSchedulerSchema` migration
- [ ] T2.2.2: Include all tables and indexes
- [ ] T2.2.3: Add partial index for active schedules
- [ ] T2.2.4: Test migration idempotency
- [x] T2.2.1: Create `V001_CreateSchedulerSchema` migration
- [x] T2.2.2: Include all tables and indexes
- [x] T2.2.3: Add partial index for active schedules
- [x] T2.2.4: Test migration idempotency
---
### T2.3: Implement Schedule Repository
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 1 day
**Interface:**
@@ -97,17 +98,17 @@ public interface IScheduleRepository
```
**Subtasks:**
- [ ] T2.3.1: Implement all interface methods
- [ ] T2.3.2: Handle soft delete correctly
- [ ] T2.3.3: Implement GetDueSchedules for trigger calculation
- [ ] T2.3.4: Write integration tests
- [x] T2.3.1: Implement all interface methods
- [x] T2.3.2: Handle soft delete correctly
- [x] T2.3.3: Implement GetDueSchedules for trigger calculation
- [x] T2.3.4: Write integration tests
---
### T2.4: Implement Run Repository
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 1 day
**Interface:**
@@ -124,56 +125,56 @@ public interface IRunRepository
```
**Subtasks:**
- [ ] T2.4.1: Implement all interface methods
- [ ] T2.4.2: Handle state transitions
- [ ] T2.4.3: Implement efficient pagination
- [ ] T2.4.4: Write integration tests
- [x] T2.4.1: Implement all interface methods
- [x] T2.4.2: Handle state transitions
- [x] T2.4.3: Implement efficient pagination
- [x] T2.4.4: Write integration tests
---
### T2.5: Implement Graph Job Repository
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 0.5 days
**Subtasks:**
- [ ] T2.5.1: Implement CRUD operations
- [ ] T2.5.2: Implement status queries
- [ ] T2.5.3: Write integration tests
- [x] T2.5.1: Implement CRUD operations
- [x] T2.5.2: Implement status queries
- [x] T2.5.3: Write integration tests
---
### T2.6: Implement Policy Job Repository
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 0.5 days
**Subtasks:**
- [ ] T2.6.1: Implement CRUD operations
- [ ] T2.6.2: Implement status queries
- [ ] T2.6.3: Write integration tests
- [x] T2.6.1: Implement CRUD operations
- [x] T2.6.2: Implement status queries
- [x] T2.6.3: Write integration tests
---
### T2.7: Implement Impact Snapshot Repository
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 0.5 days
**Subtasks:**
- [ ] T2.7.1: Implement CRUD operations
- [ ] T2.7.2: Implement queries by run
- [ ] T2.7.3: Write integration tests
- [x] T2.7.1: Implement CRUD operations
- [x] T2.7.2: Implement queries by run
- [x] T2.7.3: Write integration tests
---
### T2.8: Implement Distributed Locking
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 1 day
**Description:**
@@ -185,12 +186,12 @@ Implement distributed locking using PostgreSQL advisory locks.
3. Combination approach
**Subtasks:**
- [ ] T2.8.1: Choose locking strategy
- [ ] T2.8.2: Implement `IDistributedLock` interface
- [ ] T2.8.3: Implement lock acquisition with timeout
- [ ] T2.8.4: Implement lock renewal
- [ ] T2.8.5: Implement lock release
- [ ] T2.8.6: Write concurrency tests
- [x] T2.8.1: Choose locking strategy
- [x] T2.8.2: Implement `IDistributedLock` interface
- [x] T2.8.3: Implement lock acquisition with timeout
- [x] T2.8.4: Implement lock renewal
- [x] T2.8.5: Implement lock release
- [x] T2.8.6: Write concurrency tests
**Implementation Example:**
```csharp
@@ -225,69 +226,78 @@ public sealed class PostgresDistributedLock : IDistributedLock
### T2.9: Implement Worker Registration
**Status:** TODO
**Status:** DONE
**Assignee:** TBD
**Estimate:** 0.5 days
**Subtasks:**
- [ ] T2.9.1: Implement worker registration
- [ ] T2.9.2: Implement heartbeat updates
- [ ] T2.9.3: Implement dead worker detection
- [ ] T2.9.4: Write integration tests
- [x] T2.9.1: Implement worker registration
- [x] T2.9.2: Implement heartbeat updates
- [x] T2.9.3: Implement dead worker detection
- [x] T2.9.4: Write integration tests
---
### T2.10: Add Configuration Switch
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 0.5 days
**Subtasks:**
- [ ] T2.10.1: Update service registration
- [ ] T2.10.2: Test backend switching
- [ ] T2.10.3: Document configuration
- [x] T2.10.1: Update service registration
- [x] T2.10.2: Test backend switching
- [x] T2.10.3: Document configuration
---
### T2.11: Run Verification Tests
**Status:** TODO
**Assignee:** TBD
**Status:** DONE (fresh-start; Postgres-only verification)
**Assignee:** Scheduler Guild
**Estimate:** 1 day
**Subtasks:**
- [ ] T2.11.1: Test schedule CRUD
- [ ] T2.11.2: Test run creation and state transitions
- [ ] T2.11.3: Test trigger calculation
- [ ] T2.11.4: Test distributed locking under concurrency
- [ ] T2.11.5: Test job execution end-to-end
- [ ] T2.11.6: Generate verification report
- [x] T2.11.1: Test schedule CRUD
- [x] T2.11.2: Test run creation and state transitions
- [x] T2.11.3: Test trigger calculation
- [x] T2.11.4: Test distributed locking under concurrency
- [x] T2.11.5: Test job execution end-to-end
- [x] T2.11.6: Generate verification report (fresh-start baseline; Mongo parity not applicable)
---
### T2.12: Switch to PostgreSQL-Only
**Status:** TODO
**Assignee:** TBD
**Status:** DONE
**Assignee:** Scheduler Guild
**Estimate:** 0.5 days
**Subtasks:**
- [ ] T2.12.1: Update configuration
- [ ] T2.12.2: Deploy to staging
- [ ] T2.12.3: Run integration tests
- [ ] T2.12.4: Deploy to production
- [ ] T2.12.5: Monitor metrics
- [x] T2.12.1: Update configuration (`Persistence:Scheduler=Postgres`)
- [x] T2.12.2: Deploy to staging
- [x] T2.12.3: Run integration tests
- [x] T2.12.4: Deploy to production
- [x] T2.12.5: Monitor metrics
---
## Exit Criteria
- [ ] All repository interfaces implemented
- [ ] Distributed locking working correctly
- [ ] All integration tests pass
- [ ] Schedule execution working end-to-end
- [ ] Scheduler running on PostgreSQL in production
- [x] All repository interfaces implemented
- [x] Distributed locking working correctly
- [x] All integration tests pass (module-level)
- [x] Fresh-start verification completed (no Mongo parity/backfill)
- [x] Scheduler running on PostgreSQL in staging/production
## Execution Log
| Date (UTC) | Update | Owner |
| --- | --- | --- |
| 2025-11-28 | Project + schema migration created; repos implemented (T2.1T2.8) | Scheduler Guild |
| 2025-11-30 | Determinism and concurrency tests added; advisory locks in place | Scheduler Guild |
| 2025-12-02 | Backfill tool added; Mongo endpoint unavailable → parity/backfill blocked | Scheduler Guild |
| 2025-12-05 | Phase 0 unblocked; fresh-start approved (skip Mongo backfill). Verification done on Postgres-only baseline; cutover pending config switch/deploy. | PM |
| 2025-12-05 | Config switched to Postgres, staged and produced deployed; integration smoke passed; monitoring active. | Scheduler Guild |
---