movingsam
9b77169b80
test: add end-to-end integration tests (IMPL-12)
...
- TestFixture: Base test infrastructure with WebApplicationFactory
- K8sDiscoveryTests: K8s Service Label discovery flow tests
- ConfigConfirmationTests: Pending config confirmation flow tests
- MultiTenantRoutingTests: Tenant-specific vs default destination routing tests
- ConfigReloadTests: Gateway hot-reload via NOTIFY mechanism tests
- TestData: Mock data for K8s services, JWT tokens, database seeding
Tests cover:
1. K8s Service discovery with valid labels
2. Config confirmation -> DB write -> NOTIFY
3. Multi-tenant routing (dedicated vs default destination)
4. Gateway config hot-reload without restart
2026-03-08 10:53:19 +08:00
movingsam
4fd931d44b
IMPL-11: 更新 TenantRoutingMiddleware 适配新 Transform
...
职责分离:
- Middleware: 负责 JWT 验证、TenantId 验证、设置 ClusterId 和 TenantId 到 HttpContext.Items
- Transform: 负责从数据库查询 Destination 并设置 ProxyRequest.RequestUri
修改内容:
1. TenantRoutingMiddleware:
- 添加设置 TenantId 到 HttpContext.Items 供 Transform 使用
- 修复服务名提取正则表达式,支持连字符(-)和下划线(_)
- 更新 XML 文档,明确职责分离说明
2. TenantRoutingTransform:
- 添加 ExtractTenantId 方法,优先从 HttpContext.Items 获取 TenantId
- 保留从 JWT 提取作为回退机制
3. 单元测试:
- 新增职责分离验证测试 (ShouldNotSetDestinationUri, ShouldOnlySetClusterIdAndTenantId)
- 新增与 Transform 协作测试 (ShouldSetItemsForTransformConsumption)
- 更新服务名提取测试,支持更多字符类型
- 总测试数: 24个,全部通过
2026-03-08 01:20:20 +08:00
movingsam
52eba07097
feat: add MigrationTool for gateway config migration (IMPL-7)
...
- Create MigrationTool console app for exporting DB config to K8s YAML
- Support dry-run mode and validation
- Add Npgsql and YamlDotNet dependencies
2026-03-08 00:35:04 +08:00
movingsam
cc11c7258f
fix: 更新单元测试适配新模型
...
- RouteCacheTests: 使用 Fengling.Platform.Domain
- 更新 Id 类型为 string (Guid)
- 更新 PathPattern 为 Match.Path
- TenantRoutingMiddlewareTests: 更新 Id 类型为 string
2026-03-04 13:45:04 +08:00
movingsam
0c08620565
refactor: 升级 Fengling.Platform.Infrastructure 到 1.0.12 并迁移到新模型
...
- 升级 Fengling.Platform.Infrastructure 包到 1.0.12
- DatabaseRouteConfigProvider: 使用 GwTenantRoutes 和 GwRouteMatch
- DatabaseClusterConfigProvider: 使用 GwClusters 和内嵌 Destinations
- GatewayDbContext: 添加兼容性别名 (TenantRoutes, ServiceInstances)
- RouteCache: 更新使用新的模型结构
- 暂时禁用 GatewayConfigController 和测试 (需要重写以适配新模型)
2026-03-04 13:30:35 +08:00
movingsam
42b8c9cca5
fix: 升级 Fengling.Platform 包并修复编译警告
...
- 修复 CS0108: GatewayDbContext.Tenants 隐藏继承成员
- 修复 NU1506: 移除重复 PackageVersion 定义
- 修复 NU1507: 添加包源映射配置 (NuGet.Config)
2026-03-04 13:14:26 +08:00
movingsam
da4f03502a
refactor: reorganize project structure into yarpgateway folder
...
- Move YarpGateway and all source files to src/yarpgateway/
- Keep Fengling.Gateway.Plugin.Abstractions at src/ level
- Fix duplicate project reference in YarpGateway.slnx
- Update solution paths and test project references
- Add ProjectReference from YarpGateway to abstractions
2026-03-01 17:47:48 +08:00
movingsam
52f4b7616e
docs: add security audit and test plan
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-28 18:38:38 +08:00