AlexStocks commented on code in PR #36:
URL: https://github.com/apache/dubbo-net/pull/36#discussion_r4510584915
##########
Tests/UnitTestForDubboNet/MyNacosTest.cs:
##########
@@ -104,6 +106,94 @@ await nacos.GetProvidersAsync(Service, Group),
}
}
+ [Fact]
+ public async Task
ProviderDiscovery_DisposeRemovesOnlyItsOwnNamingSubscription()
Review Comment:
🟡 **本地 563 passed 尚未在仓库侧复现**
本 PR 的 3 个 workflow(Build and test / End-to-end tests / License header
check)在 head `1049623` 上全部停在 `action_required`,`statusCheckRollup`
为空、`mergeStateStatus=BLOCKED`——首次贡献者的 workflow 需要 maintainer 批准,因此仓库里没有任何一次针对本
head 的 build/test 记录。PR 描述的 `dotnet build` 与 `563 passed` 是本地结果(#34 也是同样的状态)。
**Why:** 本 PR 改了 32 个文件,含 20+ rename 和 namespace 变更,SDK 风格 `.csproj` 用
`Compile Remove="Tests\**"` 自动收录源码;本地通过不等于 CI 镜像里的 `dotnet build
DubboNet.sln`、单测以及 e2e 容器构建都过。
**Suggestion:** 合并前请 maintainer 批准这三个 workflow 并确认绿灯;若不便批准,至少在 PR 里贴一次对应 run
链接,避免 reviewer 把本地数字当成 CI 结论。
##########
Tests/UnitTestForDubboNet/ZooKeeperRegistryPathContractTest.cs:
##########
@@ -18,11 +18,34 @@
using DubboNet.Clients;
using DubboNet.Clients.DataModle;
using DubboNet.Clients.RegistryClient;
+using DubboNet.DubboService;
+using DubboNet.Registry;
namespace UnitTestForDubboNet
{
public class ZooKeeperRegistryPathContractTest
{
+ [Fact]
+ public void SharedProviderUrlContracts_AreOwnedByProtocol()
+ {
+ Assert.Equal("DubboNet.DubboService",
typeof(ProviderUrlKeys).Namespace);
+ Assert.Equal("DubboNet.DubboService",
typeof(ProviderProtocolSchemes).Namespace);
+ Assert.Equal("interface", ProviderUrlKeys.Interface);
+ Assert.Equal("dubbo", ProviderProtocolSchemes.Dubbo);
+ Assert.Equal("tri", ProviderProtocolSchemes.Tri);
+ }
+
+ [Fact]
+ public void
RegistryImplementationHasItsOwnNamespace_WithoutMovingPublicClients()
Review Comment:
🟡 **ZooKeeper 分支整体搬迁后没有行为回归测试**
本 PR 把 `GetSeviceProviderEndPointsAsync` 的 ZK 部分(约 120 行:`ExistsAsync`
三次判定、`GetChildrenAsync(nowFullPath, _watcher)` 一次性
watch、`_onRegistryRecovered()`、Provider URL 解析)整体搬进
`Registry/ProviderDiscovery.DiscoverAsync`,同时把
`TryGetServiceNameFromProviderPath` 变成实例方法。但新增的 4 个 `ProviderDiscovery` 测试全部用
`new ProviderDiscovery(null!, nacos, ...)` 走 FakeNacos;本文件新增的两个测试只断言 namespace
和常量字符串。也就是说 ZK 路径的搬迁**没有任何行为等价性覆盖**,`MyZookeeperTest.cs` 也没有对应新增。
**Why:** 这次是「换所有者 + 换类 + 换字段」,最容易出错的恰恰是搬代码时的隐式依赖:`_watcher` 只在 ZK 时非
null、`_rootPath` 在 Nacos 下其实是 group 名、recover 回调从内联改成委托。563 passed 说明不了被搬的分支没变。
**Suggestion:** 至少补三个 ZK 侧离线用例:① full-path 解析成功 / 失败(现在
`ReflushProviderAsync` 在 `isFullPath` 时改走
`_providerDiscovery.TryGetServiceNameFromProviderPath`);② `stat == null` /
`numChildren <= 0` 时的 `ErrorInfo` 文案与 watch 不安装;③ `numChildren > 0` 时
`_onRegistryRecovered` 恰好触发一次且 watcher 被传入 `GetChildrenAsync`。
##########
Tests/UnitTestForDubboNet/DubboMetadataContractTest.cs:
##########
@@ -17,14 +17,25 @@
using DubboNet.Clients;
using DubboNet.Clients.DataModle;
-using DubboNet.Clients.Metadata;
+using DubboNet.Metadata;
using DubboNet.Clients.RegistryClient;
+using DubboNet.Registry;
using System.Text;
namespace UnitTestForDubboNet
{
public class DubboMetadataContractTest
{
+ [Fact]
+ public void
MetadataImplementationHasItsOwnNamespace_WithoutMovingPublicModels()
Review Comment:
✅ **兼容性声明与单飞改造都经得起独立核对**
- 把 `main` 与本 PR head 的 61 个 public 类型按 `(namespace, name)`
全量比对:**零变化**。`DubboMethodMetadata` / `DubboTypeMetadata` /
`DubboMetadataException` 仍留在 `DubboNet.Clients.DataModle`,`MyNacos` /
`MyZookeeper` / `ZNode` 仍在 `DubboNet.Clients.RegistryClient`——物理目录变了但公共契约没破,PR
里「不改变 public calling API」的说法成立。
- 旧 `GetOrAdd(serviceName, _ => GetSeviceProviderEndPointsAsync(...))` 的
factory 在竞争下会被多次调用且每次都已启动 SDK 查询;改成 `GetOrAdd(key, static (request, owner) =>
new Lazy<Task<...>>(...), this)` 后,丢掉的 factory 只丢一个未求值的
`Lazy`,`ExecutionAndPublication` 保证一次查询——这个修法是对的。
- `(service, isFullPath)` 复合 key 修掉了旧 key 忽略 `isFullPath`
的问题;`TryRemove(KeyValuePair)` 保证不会误删后来者新建的 `Lazy`;对应的 full-path / 32 并发用例都测到了点上。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]