apache / dubbo-admin

The ops and reference implementation for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
3.99k stars 2.17k forks source link

feat: refactor the tag route feature with go #1030

Closed seriouszyx closed 1 year ago

seriouszyx commented 1 year ago

What is the purpose of the change

Fix: https://github.com/apache/dubbo-admin/issues/1029 Refactor the tag route feature with go

Verifying this change

Verify by postman:

CreateRule:

curl -X POST \
  http://127.0.0.1:38080/api/dev/rules/route/tag \
  -H 'cache-control: no-cache' \
  -d '{"configVersion":"v3.0","force":true,"enabled":true,"key":"shop-detail","tags":[{"name":"gray","match":[{"key":"env","value":{"exact":"gray"}}]}],"application":"my-app1"}'

UpdateRule:

curl -X PUT \
  http://127.0.0.1:38080/api/dev/rules/route/tag/my-app1 \
  -H 'cache-control: no-cache' \
  -d '{"configVersion":"v3.1","force":true,"enabled":true,"key":"shop-detail","tags":[{"name":"gray","match":[{"key":"env","value":{"exact":"gray"}}]}],"application":"my-app1"}'

SearchRoutes:

curl -X GET \
  'http://127.0.0.1:38080/api/dev/rules/route/tag?application=my-app1' \
  -H 'cache-control: no-cache' \

DetailRoute:

curl -X GET \
  http://127.0.0.1:38080/api/dev/rules/route/tag/my-app1 \
  -H 'cache-control: no-cache' \

DeleteRoute:

curl -X DELETE \
  http://127.0.0.1:38080/api/dev/rules/route/tag/my-app1 \
  -H 'cache-control: no-cache' \

EnableRoute:

curl -X PUT \
  http://127.0.0.1:38080/api/dev/rules/route/tag/enable/my-app1 \
  -H 'cache-control: no-cache' \

DisableRoute:

curl -X PUT \
  http://127.0.0.1:38080/api/dev/rules/route/tag/disable/my-app1 \
  -H 'cache-control: no-cache' \

Issues to be fixed

  1. The added unit test relies on the zookeeper environment, so the CI fails.
  2. The Update API returns the error "zk: node already exists", which should be caused by the PublishConfig func of the dubbo-go implementation.

Follow this checklist to help us incorporate your contribution quickly and easily:

AlbumenJ commented 1 year ago

Please fix conflicts

seriouszyx commented 1 year ago

Please fix conflicts

done

codecov-commenter commented 1 year ago

Codecov Report

Merging #1030 (0136bf6) into refactor-with-go (ca77afa) will decrease coverage by 2.07%. The diff coverage is 8.43%.

@@                 Coverage Diff                  @@
##           refactor-with-go    #1030      +/-   ##
====================================================
- Coverage             67.08%   65.02%   -2.07%     
====================================================
  Files                    25       27       +2     
  Lines                  1905     1967      +62     
====================================================
+ Hits                   1278     1279       +1     
- Misses                  533      593      +60     
- Partials                 94       95       +1     
Impacted Files Coverage Δ
pkg/admin/services/tag_route_service_impl.go 0.00% <0.00%> (ø)
pkg/admin/util/base_service_metadata.go 0.00% <0.00%> (ø)
pkg/admin/util/yaml_parser.go 71.42% <71.42%> (ø)
pkg/admin/services/override_service_impl.go 48.88% <100.00%> (ø)

... and 2 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information