trpc-group / trpc-go

A pluggable, high-performance RPC framework written in golang
Other
743 stars 85 forks source link

test(healthcheck): fix flaky tests by adding clean up operation in watch_test.go file #126

Closed longyue0521 closed 8 months ago

longyue0521 commented 8 months ago

进入/healthcheck目录

  1. 执行go test -race -failfast -timeout=0 -shuffle=on -count=1 .发现测试时而通过时而失败 image 分析原因——测试之间有数据依赖: 使用-shuffle=on参数打乱了测试执行顺序——当先执行TestGetWatchers后执行TestWatch则导致TestWatch失败.
    1. 执行go test -race -failfast -timeout=0 -shuffle=on -count=100 -run=TestWatch image 分析原因——测试不封闭缺少Clean up阶段,所以不能重复运行
codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (1536955) 85.54052% compared to head (d32b8ae) 85.63361%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #126 +/- ## =================================================== + Coverage 85.54052% 85.63361% +0.09309% =================================================== Files 188 188 Lines 16114 16114 =================================================== + Hits 13784 13799 +15 + Misses 1771 1756 -15 Partials 559 559 ``` | [Flag](https://app.codecov.io/gh/trpc-group/trpc-go/pull/126/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trpc-group) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/trpc-group/trpc-go/pull/126/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trpc-group) | `85.63361% <ø> (+0.09309%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trpc-group#carryforward-flags-in-the-pull-request-comment) to find out more. [see 5 files with indirect coverage changes](https://app.codecov.io/gh/trpc-group/trpc-go/pull/126/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trpc-group)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.