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

feat: support Nacos v2 as ServiceRegistry (2/n) #718

Merged
merged 7 commits into from
Sep 20, 2024
Merged

Conversation

lyt122
Copy link
Contributor

@lyt122 lyt122 commented Sep 11, 2024

ref #258

@lyt122 lyt122 marked this pull request as draft September 11, 2024 14:59
@github-actions github-actions bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 11, 2024
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 90.27778% with 7 lines in your changes missing coverage. Please review.

Project coverage is 88.40%. Comparing base (37f700e) to head (fb580a9).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
controller/registries/nacos/v2/config.go 90.62% 3 Missing and 3 partials ⚠️
controller/registries/nacos/v1/config.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #718      +/-   ##
==========================================
+ Coverage   87.94%   88.40%   +0.45%     
==========================================
  Files         128      128              
  Lines        6379     6433      +54     
==========================================
+ Hits         5610     5687      +77     
+ Misses        553      534      -19     
+ Partials      216      212       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lyt122
Copy link
Contributor Author

lyt122 commented Sep 13, 2024

@github-actions github-actions bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 16, 2024
@lyt122 lyt122 marked this pull request as ready for review September 16, 2024 03:23
@spacewander
Copy link
Member

Details

We can add a comment on the corresponding test to link to that issue.

mosniov1 "mosn.io/htnn/types/apis/v1"
)

func enableNacosV2(nacosInstance string) {
Copy link
Member

Choose a reason for hiding this comment

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

We can reuse the enableNacos?

}
}

func disableNacosV2(nacosInstance string) {
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

params.Set("metadata", string(b))
}

fullURL := nacosServerURL + "/nacos/v2/ns/instance?" + params.Encode()
Copy link
Member

Choose a reason for hiding this comment

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

We can make the ver as an argument?

@@ -19,6 +19,28 @@ services:
- "8849:8848"
networks:
service:
nacos3:
Copy link
Member

Choose a reason for hiding this comment

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

Please add v2 in the service name so people can know the difference

controller/registries/nacos/config.go Show resolved Hide resolved
@github-actions github-actions bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 18, 2024
@lyt122
Copy link
Contributor Author

lyt122 commented Sep 18, 2024

@spacewander


})

// Nacos v2 sdk have bug about data race when creating a new nacos client
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Nacos v2 sdk have bug about data race when creating a new nacos client
// Nacos v2 sdk has a bug about data race when creating a new nacos client which might cause the test to fail

})

_, err = NewClient(config)
assert.Error(t, err)
Copy link
Member

Choose a reason for hiding this comment

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

The test failed because of the bug of gomonkey when running on mac:

--- FAIL: TestNewClient (0.00s)
    config_test.go:53: 
        	Error Trace:	/Users/lzx/git/htnn/controller/registries/nacos/v1/config_test.go:53
        	Error:      	An error is expected but got nil.
        	Test:       	TestNewClient
FAIL
coverage: 16.2% of statements in mosn.io/htnn/...
FAIL	mosn.io/htnn/controller/registries/nacos/v1	7.662s
--- FAIL: TestNewClient (0.00s)
    config_test.go:58: 
        	Error Trace:	/Users/lzx/git/htnn/controller/registries/nacos/v2/config_test.go:58
        	Error:      	An error is expected but got nil.
        	Test:       	TestNewClient
FAIL
coverage: 19.7% of statements in mosn.io/htnn/...
FAIL	mosn.io/htnn/controller/registries/nacos/v2	7.695s

Would you drop the monkey patch like c0c4192?

Copy link

👋 Hi, I detected conflicts against the base branch 🙊
You'll want to sync 🔄 your branch with upstream!

@github-actions github-actions bot removed the conflict label Sep 19, 2024
@lyt122
Copy link
Contributor Author

lyt122 commented Sep 19, 2024

@spacewander

@spacewander spacewander merged commit 696b4db into mosn:main Sep 20, 2024
12 of 13 checks passed
@lyt122 lyt122 deleted the 3 branch September 22, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants