Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tst:mock etcd and nacos in ut #1873

Merged
merged 22 commits into from
May 2, 2022
Merged

Tst:mock etcd and nacos in ut #1873

merged 22 commits into from
May 2, 2022

Conversation

pherzheyu
Copy link
Contributor

@pherzheyu pherzheyu commented Apr 30, 2022

What this PR does:
mock etcd and nacos in ut

Which issue(s) this PR fixes:
Fixes #

You should pay attention to items below to ensure your pr passes our ci test
We do not merge pr with ci tests failed

  • All ut passed (run 'go test ./...' in project root)
  • After go-fmt ed , run 'go fmt project' using goland.
  • Golangci-lint passed, run 'sudo golangci-lint run' in project root.
  • After import formatted, (using imports-formatter to run 'imports-formatter .' in project root, to format your import blocks, mentioned in CONTRIBUTING.md above)
  • Your new-created file needs to have apache license at the top, like other existed file does.
  • All integration test passed. You can run integration test locally (with docker env). Clone our dubbo-go-samples project and replace the go.mod to your dubbo-go, and run 'sudo sh start_integration_test.sh' at root of samples project root. (M1 Slice is not Support)

@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2022

Codecov Report

Merging #1873 (03155c9) into 3.0 (406f801) will decrease coverage by 1.68%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##              3.0    #1873      +/-   ##
==========================================
- Coverage   46.80%   45.12%   -1.69%     
==========================================
  Files         295      295              
  Lines       17178    17178              
==========================================
- Hits         8041     7751     -290     
- Misses       8285     8595     +310     
+ Partials      852      832      -20     
Impacted Files Coverage Δ
registry/nacos/listener.go 0.00% <0.00%> (-80.87%) ⬇️
registry/etcdv3/registry.go 9.23% <0.00%> (-64.62%) ⬇️
config_center/nacos/listener.go 0.00% <0.00%> (-50.00%) ⬇️
remoting/etcdv3/listener.go 3.53% <0.00%> (-43.37%) ⬇️
registry/etcdv3/listener.go 10.00% <0.00%> (-40.00%) ⬇️
config_center/nacos/impl.go 40.59% <0.00%> (-34.66%) ⬇️
metadata/report/etcd/report.go 33.33% <0.00%> (-28.89%) ⬇️
filter/metrics/filter.go 85.00% <0.00%> (-15.00%) ⬇️
remoting/nacos/builder.go 63.76% <0.00%> (-10.15%) ⬇️
registry/nacos/registry.go 43.31% <0.00%> (-3.83%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 406f801...03155c9. Read the comment docs.

}
type args struct {
group string
}
Copy link
Contributor

Choose a reason for hiding this comment

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

如上

client: tt.fields.client,
keyListeners: tt.fields.keyListeners,
parser: tt.fields.parser,
}
Copy link
Contributor

@AlexStocks AlexStocks Apr 30, 2022

Choose a reason for hiding this comment

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

如果 n 和 tt.fields 类型相同,则可以这么写:
n := &nacosDynamicConfiguration{}
*n = tt.fields
不行就封装一个函数出来,我看你别的地方也有类似的逻辑,写一个函数也好复用。

listenerLock: tt.fields.listenerLock,
listener: tt.fields.listener,
dataListener: tt.fields.dataListener,
configListener: tt.fields.configListener,
Copy link
Contributor

Choose a reason for hiding this comment

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

如上。

Copy link
Member

@binbin0325 binbin0325 left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexStocks AlexStocks merged commit 7d4af3b into apache:3.0 May 2, 2022
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.

4 participants