Skip to content

test(generic): add isolated Go v3.3.0 provider E2E harness and usage guide - #1652

Open
dodjdnh wants to merge 7 commits into
apache:developfrom
dodjdnh:feat/generic-invoke-go-e2e
Open

dodjdnh wants to merge 7 commits into
apache:developfrom
dodjdnh:feat/generic-invoke-go-e2e

Conversation

@dodjdnh

@dodjdnh dodjdnh commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Please provide a description of this PR:

Problem

当前泛化调用缺少针对正式发布版 dubbo-go v3.3.0 Provider 的隔离端到端验证脚手架,尚未覆盖独立进程真实 RPC(L2)、带认证的真实注册中心发现(L3)以及可重放的 HTTP 使用指南。

Changes

  • 新增固定依赖官方 dubbo-go v3.3.0 的隔离 go-v330 Provider 模块(暴露 Dubbo 与 Triple unary 协议的 example.GoEchoService,通过反射填充 ServiceInfo.Methods,提供字符串/整数/嵌套整数/无参/数组回显、traceId/traceid 附件回显、可控延迟与 /count 请求计数观测端点)及可选的本地 ZooKeeper 启停脚本。
  • 新增受 RUN_DUBBO_GO_E2E=1 控制的 service 与 handler 层 L2 Go Provider 测试,复用现有内存测试上下文与路由,覆盖双协议回显、附件透传、错误 signature 在 RPC 前拦截及超时观测;普通 go test 默认跳过且不启动容器。
  • 新增 L3 认证发现脚本,支持接入外部环境或本地拉起,验证内存会话登录、真实实例与 signature 发现、HTTP 调用及非零退出码(42)负向自检。
  • 新增 Go Provider 泛化调用使用指南,覆盖环境准备、认证发现、HTTP/PowerShell 示例、返回与错误说明及清理步骤;未修改任何生产代码与根 go.mod/go.sum,大整数溢出与细粒度业务异常分类以 TODO 占位,未放宽断言。

Verification

  • 基线与提交:Base 2171b21f(upstream/develop)→ Head 8aaaab82
  • 本地静态与单元测试(HEAD 8aaaab82):
    • go vet -mod=readonly ./pkg/console/service ./pkg/console/handler:PASS(退出码 0)
    • go test -mod=readonly ./pkg/console/service ./pkg/console/handler:PASS(退出码 0,Go E2E 默认跳过)
    • go build -mod=readonly ./...(testdata/generic-invoke/go-v330):PASS(退出码 0)
    • bash -n testdata/generic-invoke/run-discovery-e2e.sh / zookeeper.sh:PASS
  • 隔离集群真实 L2 / L3 实测取证(实测于 9d2d04e;8aaaab82 仅在 go-v330/main.go 补充 ServiceInfo.Methods 反射填充,未重跑集群):
    • L2 Dubbo 回显与拦截(RUN_DUBBO_GO_E2E=1,service & handler):PASS — echo、echoInt、noArgs、echoArray、attachments、echoNested 6 项回显全部通过;错误 signature 在 RPC 前拦截且 Provider /count 未增加。
    • L2 Dubbo Timeout(delay(1000) + timeoutMs=100):FAIL — 意外返回成功。源码定位:pkg/console/service/service_generic_invoke.go 未将 req.TimeoutMs 透传给 Dubbo Client(URL 始终为默认 timeout=3s)。按 [#3792][Task D] 建立隔离的 Go v3.3.0 Provider 真实调用与发现验证 harness 及 HTTP 使用指南 #1633 权限约束不改动生产代码,保留失败并记录为产品缺陷。
    • L2 Triple 泛化调用:FAIL(版本不支持)— 返回 unimplemented: HTTP status 404 Not Found。源码核实:dubbo-go v3.3.0 的 protocol/triple/server.go 尚未实现 $invoke 泛化服务端 handler(该能力后续由 apache/dubbo-go#3154 引入)。
    • L3 真实发现链路(隔离 ZooKeeper,无手工注入):BLOCKED — 登录(POST /api/v1/auth/login)返回 Success,admin-unreachable 负向自检退出码 42(PASS),但真实发现 /provider-instances 与 /methods 返回 0,阻塞后续调用断言;未通过注入资源或放宽断言伪造通过。

Related Issues

To help us figure out who should review this PR, please put an X in all the areas that this PR affects.

  • Docs
  • Installation
  • User Experience
  • Dubboctl
  • Console
  • Core Component

…overy runner

Signed-off-by: Kevin <yaojiaangyao@gmail.com>
…ndler

Signed-off-by: Kevin <yaojiaangyao@gmail.com>
Signed-off-by: Kevin <yaojiaangyao@gmail.com>
Signed-off-by: Kevin <yaojiaangyao@gmail.com>
…fixture

Signed-off-by: Kevin <yaojiaangyao@gmail.com>
if os.Getenv("RUN_DUBBO_GO_E2E") != "1" {
t.Skip("set RUN_DUBBO_GO_E2E=1 and start go-v330 Provider")
}
// This test intentionally runs sequentially: observation counts require an isolated Provider.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 启用后这套 E2E 在当前依赖上必然失败,文档却写成已验证

go-v330 固定 dubbo-go v3.3.0;PR 描述已实测 Triple $invoke 返回 404,且 delay(1000) 在 timeoutMs=100 时意外成功。本文件仍对 tri 和 timeout 都断言成功(line 51、line 208 起),而 docs/generic-invoke.md 第 16 行写成 “Both layers assert ... Triple ... timeout”。

请对已知不支持的 Triple 和已知失败的 timeout 显式 t.Skip / expected-failure,或等产品修复后再合入;否则 RUN_DUBBO_GO_E2E=1 go test ... 只能红。

docker rm -f $id
```

Shell cleanup: stop your Provider process, then `bash testdata/generic-invoke/go-v330/zookeeper.sh stop`. Scripts never start Docker from `go test`. See [the invocation guide](../../../../docs/generic-invoke.md) for L2/L3, authentication and cleanup.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 相对链接多了一层 ..

从 testdata/generic-invoke/go-v330/README.md 出发,../../../../docs/generic-invoke.md 会解析到仓库根之外;正确目标是 ../../../docs/generic-invoke.md。请修正。

…cks by default and fix README link

Signed-off-by: Kevin <yaojiaangyao@gmail.com>
@dodjdnh

dodjdnh commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

@AlexStocks Thanks for the review! Both [P2] items have been addressed in 5b4ae22 (CI is green):

@robocanic robocanic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

总体评价

优点

  • 隔离的 go-v330 模块固定 dubbo-go v3.3.0,不改动生产代码和根 go.mod/go.sum,E2E 默认通过 RUN_DUBBO_GO_E2E=1 跳过,不会影响常规 go test。
  • 测试覆盖 L2(真实 RPC 传输)与 L3(认证发现)两层,错误 signature 在 RPC 前被拦截并用 /count 验证;ZooKeeper 脚本使用容器 ID receipt + label 校验,清理逻辑谨慎。
  • PR 描述对 Timeout / Triple / L3 的失败与阻塞如实说明,没有放宽断言伪造通过。

问题

Important(建议修复)

  1. Dockerfile 无法构建

    • 文件:testdata/generic-invoke/go-v330/Dockerfile:18
    • 问题:WORKDIR /src 后直接执行 RUN go mod download,但此前没有 COPY go.mod go.sum ./,会报 go.mod file not found;COPY main.go ./ 又在其后,go build -mod=readonly 同样缺少 go.mod/go.sum。
    • 修复:在 go mod download 之前先 COPY go.mod go.sum ./,再 COPY main.go ./。PR 验证中也没有 docker build 这一项,建议补充验证。
  2. discovery.py 默认完整流程的 timeout 断言与 PR 自述的已知缺陷冲突,且与 L2 的处理不一致

    • 文件:testdata/generic-invoke/go-v330/discovery.py:119-122(delay(1000) + timeoutMs=100 后无条件断言 InternalError);docs/generic-invoke.md("a 100 ms timeout must fail")
    • 问题:PR 描述指出 timeoutMs 尚未透传,Dubbo 调用在默认 3s 超时内会成功,即 L3 默认流程在 discovery 打通后仍会以 timeout observation failed 失败。L2 通过 RUN_DUBBO_GO_E2E_TIMEOUT 默认跳过,L3 却无条件执行,行为不一致;另外仅检查 InternalError + 耗时 < 3s,不能证明请求确实到达 Provider(任何 InternalError 如连接失败都会通过),与 L2 中 "transport failure cannot pass as timeout" 的严格断言矛盾。
    • 修复:为 L3 的 timeout 增加与 L2 相同的开关(如 RUN_DUBBO_GO_E2E_TIMEOUT=1),默认跳过;启用时同样通过 /count 验证请求到达 Provider。
  3. L3 真实发现链路未被验证(BLOCKED),L3 脚本整体处于未经验证状态

    • 文件:testdata/generic-invoke/run-discovery-e2e.sh、testdata/generic-invoke/go-v330/discovery.py:70-77
    • 问题:PR 描述中 L3 的 /provider-instances 与 /methods 返回 0,后续所有 L3 断言(含 echoNested 整数断言、负向用例 bad-signature/bad-args/unreachable)从未真实跑通;同时 run-discovery-e2e.sh 内生成的 Admin 配置字段(discovery/engine/console.auth 等)也未得到验证。此外轮询阶段使用 success(),一旦发现尚未就绪时接口返回非 Success 的 code 或 HTTP 错误,会直接抛异常而不是继续重试,与 "polls for up to 90 seconds" 的文档描述不符。
    • 修复:先定位并解决发现为 0 的根因(Provider 注册的元数据/应用级实例与 Admin ZooKeeper discovery 期望是否匹配),或在文档与 PR 中明确标注 L3 为未验证/实验性;轮询循环中对 RuntimeError、urllib.error.HTTPError 做重试处理。

Critical

  • 未发现。

总体结论

可合并?:修复后可合并(With fixes)

测试脚手架思路清晰、对生产代码零侵入,但 Dockerfile 无法构建、L3 脚本的 timeout 断言与已知产品缺陷冲突且 L3 未真正跑通,建议先修复以上 Important 项,避免合入后默认流程即失败。

…iscovery poll retries

Signed-off-by: Kevin <yaojiaangyao@gmail.com>
@sonarqubecloud

sonarqubecloud Bot commented Dec 6, 2026

Copy link
Copy Markdown

@dodjdnh

dodjdnh commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

@robocanic 感谢 review!逐条核对并已在 c6d12db 中处理:

  1. Dockerfile 核实:testdata/generic-invoke/go-v330/Dockerfile 第 17 行已先执行 COPY go.mod go.sum ./,再在第 18 行执行 RUN go mod download、第 19 行 COPY main.go ./;本地也验证了 testdata/generic-invoke/go-v330 下 go build -mod=readonly 通过。
  2. discovery.py 的 timeout 开关与 /count 对齐 L2:已将 delay(1000) + timeoutMs=100 改为默认跳过、通过 RUN_DUBBO_GO_E2E_TIMEOUT=1 开启,与 L2 保持一致;开启时同样请求 GO_PROVIDER_OBSERVATION_URL/count 确认请求确实到达 Provider,避免把连接失败等 InternalError 误判为超时。
  3. L3 轮询容错与实验性状态说明:已为 discovery.py 的 90 秒发现轮询循环补充 (OSError, ValueError, RuntimeError) 异常重试(覆盖 HTTPError 与非 Success 响应),并在 docs/generic-invoke.md 中明确标注针对 dubbo-go v3.3.0 的 L3 发现暂返回 0 实例、当前为实验性/未端到端跑通状态,同时同步了 RUN_DUBBO_GO_E2E_TIMEOUT=1 说明。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#3792][Task D] 建立隔离的 Go v3.3.0 Provider 真实调用与发现验证 harness 及 HTTP 使用指南

3 participants