AlexStocks commented on PR #27:
URL: https://github.com/apache/dubbo-net/pull/27#issuecomment-6687868583

   补一个方法论声明,免得上面那条 🟡 被当成实测结论。
   
   我这边没有 .NET SDK 环境,**「删掉特判测试依旧通过」是静态推演**,不是本地跑出来的。推演链条是:
   
   1. `ubuntu-22.04` 的 `/etc/hosts` 默认同时含 `127.0.0.1 localhost` 与 `::1 
localhost`(GitHub runner 镜像如此);
   2. `Dns.GetHostAddressesAsync("localhost")` 交给系统解析器,返回这两条(顺序不保证);
   3. 方法里的 `OrderBy(item => item.AddressFamily == AddressFamily.InterNetwork ? 
0 : 1)` 把 IPv4 排前面 → `[127.0.0.1, ::1]`;
   4. 断言要求精确等于 `[127.0.0.1, ::1]` → 通过。
   
   所以结论是有条件的:**只要 runner 的 hosts 
或解析器行为让「未修复时的结果」恰好等于期望数组,这条测试就没有判别力**。反过来说,如果哪天镜像只返回 `127.0.0.1`,它会因为「结果少一项」而红 
—— 而那时红的原因是环境变了,不是代码回归了。
   
   这两种情况都不是我们想要的:测试的语义应该由代码决定,而不是由 runner 的 `/etc/hosts` 决定。这也是我建议注入 resolver 
的原因 —— 桩返回一个非回环地址,在任何平台都能稳定复现 #26 的症状。
   


-- 
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]

Reply via email to