Conversation
只补测试与文档,不改任何实现与接口签名。 测试(新增 14 条,独立文件 Features/TenantFeatureCheckerBoundaryTests.cs): - 平台态(无租户上下文、Id 为 0 或负数)取不到值且不查设置存储,是否启用由调用方 defaultValue 决定 - 租户甲设了功能而租户乙未设时互不串味;两租户各取各的值 - Change 作用域内取值随上下文变(含嵌套、切到平台态),离开作用域后还原 - 功能名会修剪、设定值不修剪:" true " 判为未启用且不被 defaultValue 放行;全空白值按未设置处理;显式 false 不受 defaultValue 影响 文档:docs/packages/multitenancy.md 的「租户功能开关」补写取值口径(平台态由 defaultValue 决定、租户隔离、设定值需精确为 true/false),并更正原文把 ProviderKey 写成租户名称优先、以及把非真值统一说成返回 defaultValue 的不准确之处。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
TenantFeatureChecker的平台态与跨租户边界此前没有测试,文档对取值口径的描述也不准确。本 PR 只补测试与文档,无行为变更,不改任何实现与ITenantFeatureChecker签名。改动
framework/test/XiHan.Framework.MultiTenancy.Tests/Features/TenantFeatureCheckerBoundaryTests.csdocs/packages/multitenancy.md语义(测试固定的现状)
Id <= 0):GetValueOrNullAsync返回null且不查设置存储,IsEnabledAsync完全由调用方defaultValue决定。这是设计使然,平台态没有租户级特性值。Feature:x = true、租户乙未设时互不串味;ICurrentTenant.Change(tenantId)作用域内取值随上下文变,离开作用域后还原。Trim,设定值不修剪:" true "判为未启用,且不会被defaultValue: true放行(保守拒绝);设定值需精确为true/false等。破坏性变更
无。
测试
MultiTenancy.Tests 新增 14 条(平台态 6、跨租户与作用域 4、功能名与设定值口径 4)。用例对照实现做过反向验证:去掉
tenantId <= 0判断或功能名Trim后相应用例失败。验证
dotnet build framework/XiHan.Framework.slnx -c Release -p:GeneratePackageOnBuild=false:0 警告 0 错误dotnet test --solution framework/XiHan.Framework.slnx -c Release:总计 11716,失败 0,略过 38(既有的外部服务自跳过)pnpm --dir docs build:成功