You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/12/30 02:25:34 UTC

[GitHub] [dubbo-go] A-Wanderer opened a new pull request #1693: add unit test

A-Wanderer opened a new pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693


   <!--  Thanks for sending a pull request!
   Read https://github.com/apache/dubbo-go/blob/master/CONTRIBUTING.md before commit pull request.
   -->
   
   **What this PR does**:
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #
   
   **Special notes for your reviewer**:
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
   -->
   ```release-note
   add some unit test
   ```


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] codecov-commenter commented on pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#issuecomment-1007987412


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1693](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (bbb2208) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/9a12e9948587241529cbd48c25829432f7d01e90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a12e99) will **increase** coverage by `1.70%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1693/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              3.0    #1693      +/-   ##
   ==========================================
   + Coverage   41.26%   42.96%   +1.70%     
   ==========================================
     Files         254      255       +1     
     Lines       14589    14671      +82     
   ==========================================
   + Hits         6020     6304     +284     
   + Misses       7871     7650     -221     
   - Partials      698      717      +19     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `26.49% <0.00%> (-8.61%)` | :arrow_down: |
   | [filter/generic/util.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL2dlbmVyaWMvdXRpbC5nbw==) | `66.66% <0.00%> (-2.30%)` | :arrow_down: |
   | [protocol/dubbo3/dubbo3\_protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8zL2R1YmJvM19wcm90b2NvbC5nbw==) | `54.54% <0.00%> (-1.71%)` | :arrow_down: |
   | [protocol/invocation/rpcinvocation.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvaW52b2NhdGlvbi9ycGNpbnZvY2F0aW9uLmdv) | `15.83% <0.00%> (-1.44%)` | :arrow_down: |
   | [config/config\_center\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2NvbmZpZ19jZW50ZXJfY29uZmlnLmdv) | `50.00% <0.00%> (-0.49%)` | :arrow_down: |
   | [protocol/result.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvcmVzdWx0Lmdv) | `0.00% <0.00%> (ø)` | |
   | [cluster/loadbalance/p2c/loadbalance.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9sb2FkYmFsYW5jZS9wMmMvbG9hZGJhbGFuY2UuZ28=) | `76.36% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.12% <0.00%> (+0.09%)` | :arrow_up: |
   | [cluster/cluster/base/cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL2Jhc2UvY2x1c3Rlcl9pbnZva2VyLmdv) | `24.44% <0.00%> (+0.26%)` | :arrow_up: |
   | ... and [12 more](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9a12e99...bbb2208](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#issuecomment-1007987412


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1693](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (bbb2208) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/241e2390c2987bda0a17ef8a057644853a7606b0?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (241e239) will **increase** coverage by `1.60%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head bbb2208 differs from pull request most recent head 12ea66b. Consider uploading reports for the commit 12ea66b to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1693/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              3.0    #1693      +/-   ##
   ==========================================
   + Coverage   41.36%   42.96%   +1.60%     
   ==========================================
     Files         255      255              
     Lines       14664    14671       +7     
   ==========================================
   + Hits         6066     6304     +238     
   + Misses       7899     7650     -249     
   - Partials      699      717      +18     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [protocol/dubbo3/dubbo3\_protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8zL2R1YmJvM19wcm90b2NvbC5nbw==) | `54.54% <0.00%> (-1.71%)` | :arrow_down: |
   | [common/proxy/proxy.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3Byb3h5L3Byb3h5Lmdv) | `76.86% <0.00%> (+0.74%)` | :arrow_up: |
   | [...tocol/rest/server/server\_impl/go\_restful\_server.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvcmVzdC9zZXJ2ZXIvc2VydmVyX2ltcGwvZ29fcmVzdGZ1bF9zZXJ2ZXIuZ28=) | `44.82% <0.00%> (+3.44%)` | :arrow_up: |
   | [config\_center/apollo/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnX2NlbnRlci9hcG9sbG8vbGlzdGVuZXIuZ28=) | `82.60% <0.00%> (+4.34%)` | :arrow_up: |
   | [protocol/dubbo3/dubbo3\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8zL2R1YmJvM19pbnZva2VyLmdv) | `57.39% <0.00%> (+4.71%)` | :arrow_up: |
   | [registry/zookeeper/service\_discovery.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL3NlcnZpY2VfZGlzY292ZXJ5Lmdv) | `14.02% <0.00%> (+12.80%)` | :arrow_up: |
   | [registry/etcdv3/service\_discovery.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXRjZHYzL3NlcnZpY2VfZGlzY292ZXJ5Lmdv) | `24.16% <0.00%> (+22.81%)` | :arrow_up: |
   | [protocol/dubbo/dubbo\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8vZHViYm9faW52b2tlci5nbw==) | `27.83% <0.00%> (+27.83%)` | :arrow_up: |
   | [registry/nacos/service\_discovery.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvbmFjb3Mvc2VydmljZV9kaXNjb3ZlcnkuZ28=) | `42.24% <0.00%> (+41.17%)` | :arrow_up: |
   | [protocol/dubbo/dubbo\_protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8vZHViYm9fcHJvdG9jb2wuZ28=) | `59.80% <0.00%> (+57.84%)` | :arrow_up: |
   | ... and [1 more](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5af8e93...12ea66b](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#issuecomment-1007987412


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1693](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (bbb2208) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/9a12e9948587241529cbd48c25829432f7d01e90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a12e99) will **increase** coverage by `1.70%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head bbb2208 differs from pull request most recent head 8af7c18. Consider uploading reports for the commit 8af7c18 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1693/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              3.0    #1693      +/-   ##
   ==========================================
   + Coverage   41.26%   42.96%   +1.70%     
   ==========================================
     Files         254      255       +1     
     Lines       14589    14671      +82     
   ==========================================
   + Hits         6020     6304     +284     
   + Misses       7871     7650     -221     
   - Partials      698      717      +19     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `26.49% <0.00%> (-8.61%)` | :arrow_down: |
   | [filter/generic/util.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL2dlbmVyaWMvdXRpbC5nbw==) | `66.66% <0.00%> (-2.30%)` | :arrow_down: |
   | [protocol/dubbo3/dubbo3\_protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8zL2R1YmJvM19wcm90b2NvbC5nbw==) | `54.54% <0.00%> (-1.71%)` | :arrow_down: |
   | [protocol/invocation/rpcinvocation.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvaW52b2NhdGlvbi9ycGNpbnZvY2F0aW9uLmdv) | `15.83% <0.00%> (-1.44%)` | :arrow_down: |
   | [config/config\_center\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2NvbmZpZ19jZW50ZXJfY29uZmlnLmdv) | `50.00% <0.00%> (-0.49%)` | :arrow_down: |
   | [protocol/result.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvcmVzdWx0Lmdv) | `0.00% <0.00%> (ø)` | |
   | [cluster/loadbalance/p2c/loadbalance.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9sb2FkYmFsYW5jZS9wMmMvbG9hZGJhbGFuY2UuZ28=) | `76.36% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.12% <0.00%> (+0.09%)` | :arrow_up: |
   | [cluster/cluster/base/cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL2Jhc2UvY2x1c3Rlcl9pbnZva2VyLmdv) | `24.44% <0.00%> (+0.26%)` | :arrow_up: |
   | ... and [12 more](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9a12e99...8af7c18](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] LaurenceLiZhixin merged pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin merged pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693


   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] LaurenceLiZhixin commented on pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin commented on pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#issuecomment-1005457835


   单元测试未通过。本地跑一下,不要依赖真实的注册组件。 @A-Wanderer 


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] LaurenceLiZhixin commented on a change in pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin commented on a change in pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#discussion_r784608116



##########
File path: registry/etcdv3/service_discovery_test.go
##########
@@ -17,51 +17,128 @@
 
 package etcdv3
 
-//
-//var testName = "test"
-//
-//func setUp() {
-//	config.GetRootConfig().ServiceDiscoveries[testName] = &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: testName,
-//	}
-//
-//	//config.GetRootConfig().Remotes[testName] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//}
-//
-//func Test_newEtcdV3ServiceDiscovery(t *testing.T) {
-//	name := constant.ETCDV3_KEY
-//	_, err := newEtcdV3ServiceDiscovery()
-//
-//	// warn: log configure file name is nil
-//	assert.NotNil(t, err)
-//
-//	sdc := &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: "mock",
-//	}
-//	config.GetRootConfig().ServiceDiscoveries[name] = sdc
-//
-//	_, err = newEtcdV3ServiceDiscovery()
-//
-//	// RemoteConfig not found
-//	assert.NotNil(t, err)
-//
-//	//config.GetRootConfig().Remotes["mock"] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//
-//	res, err := newEtcdV3ServiceDiscovery()
-//	assert.Nil(t, err)
-//	assert.NotNil(t, res)
-//}
-//
-//func TestEtcdV3ServiceDiscovery_GetDefaultPageSize(t *testing.T) {
-//	setUp()
-//	serviceDiscovery := &etcdV3ServiceDiscovery{}
-//	assert.Equal(t, registry.DefaultPageSize, serviceDiscovery.GetDefaultPageSize())
-//}
+import (
+	"context"
+	"sync"
+	"testing"
+)
+
+import (
+	"github.com/stretchr/testify/assert"
+)
+
+import (
+	"dubbo.apache.org/dubbo-go/v3/common"
+	"dubbo.apache.org/dubbo-go/v3/common/constant"
+	"dubbo.apache.org/dubbo-go/v3/common/extension"
+	"dubbo.apache.org/dubbo-go/v3/protocol"
+	"dubbo.apache.org/dubbo-go/v3/registry"
+)
+
+const testName = "test"
+
+func Test_newEtcdV3ServiceDiscovery(t *testing.T) {

Review comment:
        @A-Wanderer  测试方法名统一一下吧,都用驼峰。




-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#issuecomment-1007987412


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1693](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (bbb2208) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/9a12e9948587241529cbd48c25829432f7d01e90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a12e99) will **increase** coverage by `1.70%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head bbb2208 differs from pull request most recent head 8d81472. Consider uploading reports for the commit 8d81472 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1693/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              3.0    #1693      +/-   ##
   ==========================================
   + Coverage   41.26%   42.96%   +1.70%     
   ==========================================
     Files         254      255       +1     
     Lines       14589    14671      +82     
   ==========================================
   + Hits         6020     6304     +284     
   + Misses       7871     7650     -221     
   - Partials      698      717      +19     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [filter/metrics/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL21ldHJpY3MvZmlsdGVyLmdv) | `85.00% <0.00%> (-15.00%)` | :arrow_down: |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `26.49% <0.00%> (-8.61%)` | :arrow_down: |
   | [filter/generic/util.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL2dlbmVyaWMvdXRpbC5nbw==) | `66.66% <0.00%> (-2.30%)` | :arrow_down: |
   | [protocol/dubbo3/dubbo3\_protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8zL2R1YmJvM19wcm90b2NvbC5nbw==) | `54.54% <0.00%> (-1.71%)` | :arrow_down: |
   | [protocol/invocation/rpcinvocation.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvaW52b2NhdGlvbi9ycGNpbnZvY2F0aW9uLmdv) | `15.83% <0.00%> (-1.44%)` | :arrow_down: |
   | [config/config\_center\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2NvbmZpZ19jZW50ZXJfY29uZmlnLmdv) | `50.00% <0.00%> (-0.49%)` | :arrow_down: |
   | [protocol/result.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvcmVzdWx0Lmdv) | `0.00% <0.00%> (ø)` | |
   | [cluster/loadbalance/p2c/loadbalance.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9sb2FkYmFsYW5jZS9wMmMvbG9hZGJhbGFuY2UuZ28=) | `76.36% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.12% <0.00%> (+0.09%)` | :arrow_up: |
   | [cluster/cluster/base/cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL2Jhc2UvY2x1c3Rlcl9pbnZva2VyLmdv) | `24.44% <0.00%> (+0.26%)` | :arrow_up: |
   | ... and [12 more](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9a12e99...8d81472](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#discussion_r776571695



##########
File path: registry/etcdv3/service_discovery_test.go
##########
@@ -17,51 +17,145 @@
 
 package etcdv3
 
-//
-//var testName = "test"
-//
-//func setUp() {
-//	config.GetRootConfig().ServiceDiscoveries[testName] = &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: testName,
-//	}
-//
-//	//config.GetRootConfig().Remotes[testName] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//}
-//
-//func Test_newEtcdV3ServiceDiscovery(t *testing.T) {
-//	name := constant.ETCDV3_KEY
-//	_, err := newEtcdV3ServiceDiscovery()
-//
-//	// warn: log configure file name is nil
-//	assert.NotNil(t, err)
-//
-//	sdc := &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: "mock",
-//	}
-//	config.GetRootConfig().ServiceDiscoveries[name] = sdc
-//
-//	_, err = newEtcdV3ServiceDiscovery()
-//
-//	// RemoteConfig not found
-//	assert.NotNil(t, err)
-//
-//	//config.GetRootConfig().Remotes["mock"] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//
-//	res, err := newEtcdV3ServiceDiscovery()
-//	assert.Nil(t, err)
-//	assert.NotNil(t, res)
-//}
-//
-//func TestEtcdV3ServiceDiscovery_GetDefaultPageSize(t *testing.T) {
-//	setUp()
-//	serviceDiscovery := &etcdV3ServiceDiscovery{}
-//	assert.Equal(t, registry.DefaultPageSize, serviceDiscovery.GetDefaultPageSize())
-//}
+import (
+	"context"
+	"sync"
+	"testing"
+)
+
+import (
+	gxset "github.com/dubbogo/gost/container/set"
+
+	"github.com/stretchr/testify/assert"
+)
+
+import (
+	"dubbo.apache.org/dubbo-go/v3/common"
+	"dubbo.apache.org/dubbo-go/v3/common/constant"
+	"dubbo.apache.org/dubbo-go/v3/common/extension"
+	"dubbo.apache.org/dubbo-go/v3/protocol"
+	"dubbo.apache.org/dubbo-go/v3/registry"
+	"dubbo.apache.org/dubbo-go/v3/registry/event"
+)
+
+const testName = "test"
+
+func Test_newEtcdV3ServiceDiscovery(t *testing.T) {
+	url, _ := common.NewURL("dubbo://127.0.0.1:2379")
+	sd, err := newEtcdV3ServiceDiscovery(url)
+	assert.Nil(t, err)
+	err = sd.Destroy()
+	assert.Nil(t, err)
+}
+
+func TestEtcdV3ServiceDiscovery_GetDefaultPageSize(t *testing.T) {
+	serviceDiscovery := &etcdV3ServiceDiscovery{}
+	assert.Equal(t, registry.DefaultPageSize, serviceDiscovery.GetDefaultPageSize())
+}
+
+func Test_Function(t *testing.T) {
+
+	extension.SetProtocol("mock", func() protocol.Protocol {
+		return &mockProtocol{}
+	})
+
+	url, _ := common.NewURL("dubbo://127.0.0.1:2379")
+	sd, _ := newEtcdV3ServiceDiscovery(url)
+	defer func() {
+		_ = sd.Destroy()
+	}()
+
+	ins := &registry.DefaultServiceInstance{
+		ID:          "testID",
+		ServiceName: testName,
+		Host:        "127.0.0.1",
+		Port:        2233,
+		Enable:      true,
+		Healthy:     true,
+		Metadata:    nil,
+	}
+	ins.Metadata = map[string]string{"t1": "test12", constant.MetadataServiceURLParamsPropertyName: `{"protocol":"mock","timeout":"10000","version":"1.0.0","dubbo":"2.0.2","release":"2.7.6","port":"2233"}`}
+	err := sd.Register(ins)
+	assert.Nil(t, err)
+
+	wg := &sync.WaitGroup{}
+	wg.Add(1)
+	tn := &testNotify{
+		wg: wg,
+		t:  t,
+	}
+	hs := gxset.NewSet()
+	hs.Add(testName)
+
+	sicl := event.NewServiceInstancesChangedListener(hs)
+	sicl.AddListenerAndNotify(testName, tn)
+	err = sd.AddListener(sicl)
+	assert.NoError(t, err)
+
+	ins = &registry.DefaultServiceInstance{
+		ID:          "testID",
+		ServiceName: testName,
+		Host:        "127.0.0.1",
+		Port:        2233,
+		Enable:      true,
+		Healthy:     true,
+		Metadata:    nil,
+	}
+	ins.Metadata = map[string]string{"t1": "test12", constant.MetadataServiceURLParamsPropertyName: `{"protocol":"mock","timeout":"10000","version":"1.0.0","dubbo":"2.0.2","release":"2.7.6","port":"2233"}`}
+	err = sd.Update(ins)
+	assert.NoError(t, err)
+	tn.wg.Wait()
+}
+
+type testNotify struct {
+	wg *sync.WaitGroup
+	t  *testing.T
+}
+
+func (tn *testNotify) Notify(e *registry.ServiceEvent) {
+	assert.Equal(tn.t, "2233", e.Service.Port)
+	tn.wg.Done()
+}
+func (tn *testNotify) NotifyAll([]*registry.ServiceEvent, func()) {

Review comment:
       这个函数上面留一个空行。函数之间不要连在一起。




-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#discussion_r776571600



##########
File path: registry/etcdv3/service_discovery_test.go
##########
@@ -17,51 +17,145 @@
 
 package etcdv3
 
-//
-//var testName = "test"
-//
-//func setUp() {
-//	config.GetRootConfig().ServiceDiscoveries[testName] = &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: testName,
-//	}
-//
-//	//config.GetRootConfig().Remotes[testName] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//}
-//
-//func Test_newEtcdV3ServiceDiscovery(t *testing.T) {
-//	name := constant.ETCDV3_KEY
-//	_, err := newEtcdV3ServiceDiscovery()
-//
-//	// warn: log configure file name is nil
-//	assert.NotNil(t, err)
-//
-//	sdc := &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: "mock",
-//	}
-//	config.GetRootConfig().ServiceDiscoveries[name] = sdc
-//
-//	_, err = newEtcdV3ServiceDiscovery()
-//
-//	// RemoteConfig not found
-//	assert.NotNil(t, err)
-//
-//	//config.GetRootConfig().Remotes["mock"] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//
-//	res, err := newEtcdV3ServiceDiscovery()
-//	assert.Nil(t, err)
-//	assert.NotNil(t, res)
-//}
-//
-//func TestEtcdV3ServiceDiscovery_GetDefaultPageSize(t *testing.T) {
-//	setUp()
-//	serviceDiscovery := &etcdV3ServiceDiscovery{}
-//	assert.Equal(t, registry.DefaultPageSize, serviceDiscovery.GetDefaultPageSize())
-//}
+import (
+	"context"
+	"sync"
+	"testing"
+)
+
+import (
+	gxset "github.com/dubbogo/gost/container/set"
+
+	"github.com/stretchr/testify/assert"
+)
+
+import (
+	"dubbo.apache.org/dubbo-go/v3/common"
+	"dubbo.apache.org/dubbo-go/v3/common/constant"
+	"dubbo.apache.org/dubbo-go/v3/common/extension"
+	"dubbo.apache.org/dubbo-go/v3/protocol"
+	"dubbo.apache.org/dubbo-go/v3/registry"
+	"dubbo.apache.org/dubbo-go/v3/registry/event"
+)
+
+const testName = "test"
+
+func Test_newEtcdV3ServiceDiscovery(t *testing.T) {
+	url, _ := common.NewURL("dubbo://127.0.0.1:2379")
+	sd, err := newEtcdV3ServiceDiscovery(url)
+	assert.Nil(t, err)
+	err = sd.Destroy()
+	assert.Nil(t, err)
+}
+
+func TestEtcdV3ServiceDiscovery_GetDefaultPageSize(t *testing.T) {
+	serviceDiscovery := &etcdV3ServiceDiscovery{}
+	assert.Equal(t, registry.DefaultPageSize, serviceDiscovery.GetDefaultPageSize())
+}
+
+func Test_Function(t *testing.T) {
+
+	extension.SetProtocol("mock", func() protocol.Protocol {
+		return &mockProtocol{}
+	})
+
+	url, _ := common.NewURL("dubbo://127.0.0.1:2379")
+	sd, _ := newEtcdV3ServiceDiscovery(url)
+	defer func() {
+		_ = sd.Destroy()
+	}()
+
+	ins := &registry.DefaultServiceInstance{
+		ID:          "testID",
+		ServiceName: testName,
+		Host:        "127.0.0.1",
+		Port:        2233,
+		Enable:      true,
+		Healthy:     true,
+		Metadata:    nil,
+	}
+	ins.Metadata = map[string]string{"t1": "test12", constant.MetadataServiceURLParamsPropertyName: `{"protocol":"mock","timeout":"10000","version":"1.0.0","dubbo":"2.0.2","release":"2.7.6","port":"2233"}`}
+	err := sd.Register(ins)
+	assert.Nil(t, err)
+
+	wg := &sync.WaitGroup{}
+	wg.Add(1)
+	tn := &testNotify{
+		wg: wg,
+		t:  t,
+	}
+	hs := gxset.NewSet()
+	hs.Add(testName)
+
+	sicl := event.NewServiceInstancesChangedListener(hs)
+	sicl.AddListenerAndNotify(testName, tn)
+	err = sd.AddListener(sicl)
+	assert.NoError(t, err)
+
+	ins = &registry.DefaultServiceInstance{
+		ID:          "testID",
+		ServiceName: testName,
+		Host:        "127.0.0.1",
+		Port:        2233,
+		Enable:      true,
+		Healthy:     true,
+		Metadata:    nil,
+	}
+	ins.Metadata = map[string]string{"t1": "test12", constant.MetadataServiceURLParamsPropertyName: `{"protocol":"mock","timeout":"10000","version":"1.0.0","dubbo":"2.0.2","release":"2.7.6","port":"2233"}`}
+	err = sd.Update(ins)
+	assert.NoError(t, err)
+	tn.wg.Wait()
+}
+
+type testNotify struct {
+	wg *sync.WaitGroup
+	t  *testing.T
+}
+
+func (tn *testNotify) Notify(e *registry.ServiceEvent) {
+	assert.Equal(tn.t, "2233", e.Service.Port)
+	tn.wg.Done()
+}
+func (tn *testNotify) NotifyAll([]*registry.ServiceEvent, func()) {
+

Review comment:
       写代码的时候不要太随意。没有 body 的 func 不要留空行。




-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] justxuewei commented on a change in pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
justxuewei commented on a change in pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#discussion_r784521242



##########
File path: registry/etcdv3/service_discovery_test.go
##########
@@ -17,51 +17,128 @@
 
 package etcdv3
 
-//
-//var testName = "test"
-//
-//func setUp() {
-//	config.GetRootConfig().ServiceDiscoveries[testName] = &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: testName,
-//	}
-//
-//	//config.GetRootConfig().Remotes[testName] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//}
-//
-//func Test_newEtcdV3ServiceDiscovery(t *testing.T) {
-//	name := constant.ETCDV3_KEY
-//	_, err := newEtcdV3ServiceDiscovery()
-//
-//	// warn: log configure file name is nil
-//	assert.NotNil(t, err)
-//
-//	sdc := &config.ServiceDiscoveryConfig{
-//		Protocol:  "etcdv3",
-//		RemoteRef: "mock",
-//	}
-//	config.GetRootConfig().ServiceDiscoveries[name] = sdc
-//
-//	_, err = newEtcdV3ServiceDiscovery()
-//
-//	// RemoteConfig not found
-//	assert.NotNil(t, err)
-//
-//	//config.GetRootConfig().Remotes["mock"] = &config.RemoteConfig{
-//	//	Address:    "localhost:2379",
-//	//	TimeoutStr: "10s",
-//	//}
-//
-//	res, err := newEtcdV3ServiceDiscovery()
-//	assert.Nil(t, err)
-//	assert.NotNil(t, res)
-//}
-//
-//func TestEtcdV3ServiceDiscovery_GetDefaultPageSize(t *testing.T) {
-//	setUp()
-//	serviceDiscovery := &etcdV3ServiceDiscovery{}
-//	assert.Equal(t, registry.DefaultPageSize, serviceDiscovery.GetDefaultPageSize())
-//}
+import (
+	"context"
+	"sync"
+	"testing"
+)
+
+import (
+	"github.com/stretchr/testify/assert"
+)
+
+import (
+	"dubbo.apache.org/dubbo-go/v3/common"
+	"dubbo.apache.org/dubbo-go/v3/common/constant"
+	"dubbo.apache.org/dubbo-go/v3/common/extension"
+	"dubbo.apache.org/dubbo-go/v3/protocol"
+	"dubbo.apache.org/dubbo-go/v3/registry"
+)
+
+const testName = "test"
+
+func Test_newEtcdV3ServiceDiscovery(t *testing.T) {

Review comment:
       Please remove `_` from the test name.




-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1693: add unit test

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1693:
URL: https://github.com/apache/dubbo-go/pull/1693#issuecomment-1007987412


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1693](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ae9d3c0) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/0f93d1c49020e2c0d3cc8d12a5511b5feb56e134?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0f93d1c) will **increase** coverage by `1.32%`.
   > The diff coverage is `32.22%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1693/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              3.0    #1693      +/-   ##
   ==========================================
   + Coverage   41.31%   42.64%   +1.32%     
   ==========================================
     Files         255      255              
     Lines       14705    14719      +14     
   ==========================================
   + Hits         6076     6277     +201     
   + Misses       7930     7725     -205     
   - Partials      699      717      +18     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [cluster/cluster/zoneaware/cluster\_interceptor.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL3pvbmVhd2FyZS9jbHVzdGVyX2ludGVyY2VwdG9yLmdv) | `40.00% <0.00%> (ø)` | |
   | [common/proxy/proxy\_factory/pass\_through.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3Byb3h5L3Byb3h5X2ZhY3RvcnkvcGFzc190aHJvdWdoLmdv) | `31.91% <0.00%> (ø)` | |
   | [protocol/dubbo/dubbo\_codec.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8vZHViYm9fY29kZWMuZ28=) | `1.87% <0.00%> (ø)` | |
   | [protocol/dubbo/dubbo\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8vZHViYm9faW52b2tlci5nbw==) | `27.83% <0.00%> (+27.83%)` | :arrow_up: |
   | [protocol/result.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvcmVzdWx0Lmdv) | `0.00% <ø> (ø)` | |
   | [protocol/invocation/rpcinvocation.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvaW52b2NhdGlvbi9ycGNpbnZvY2F0aW9uLmdv) | `13.97% <16.32%> (-1.87%)` | :arrow_down: |
   | [protocol/dubbo3/dubbo3\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJvdG9jb2wvZHViYm8zL2R1YmJvM19pbnZva2VyLmdv) | `57.39% <33.33%> (ø)` | |
   | [common/proxy/proxy.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3Byb3h5L3Byb3h5Lmdv) | `76.86% <66.66%> (ø)` | |
   | [cluster/cluster/zoneaware/cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL3pvbmVhd2FyZS9jbHVzdGVyX2ludm9rZXIuZ28=) | `80.55% <100.00%> (ø)` | |
   | [filter/active/filter.go](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL2FjdGl2ZS9maWx0ZXIuZ28=) | `52.38% <100.00%> (ø)` | |
   | ... and [11 more](https://codecov.io/gh/apache/dubbo-go/pull/1693/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [08e4387...ae9d3c0](https://codecov.io/gh/apache/dubbo-go/pull/1693?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org