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

bugfix: move function getListener() to pkg/net/listener.go #2040

Merged
merged 1 commit into from
Aug 3, 2018

Conversation

YaoZengzeng
Copy link
Contributor

Signed-off-by: YaoZengzeng [email protected]

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pouchrobot pouchrobot added kind/bug This is bug report for project size/XL labels Aug 2, 2018
func GetListener(addr string, tlsConfig *tls.Config) (net.Listener, error) {
addrParts := strings.SplitN(addr, "://", 2)
if len(addrParts) != 2 {
return nil, fmt.Errorf("invalid listening address: %s", addr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think in a common function, we could give more details about the error message. How about adding like this:

fmt.Errorf("invalid listening address %s: address must be [protocol]://[address]", addr)

@YaoZengzeng YaoZengzeng force-pushed the net-tools branch 3 times, most recently from 06214a2 to efed1e5 Compare August 2, 2018 10:01
@YaoZengzeng YaoZengzeng changed the title bugfix: move function getListener() to pkg/net/listener.go [WIP]bugfix: move function getListener() to pkg/net/listener.go Aug 2, 2018
@codecov-io
Copy link

codecov-io commented Aug 2, 2018

Codecov Report

Merging #2040 into master will increase coverage by 12.59%.
The diff coverage is 64.58%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #2040       +/-   ##
===========================================
+ Coverage   51.18%   63.78%   +12.59%     
===========================================
  Files         200      201        +1     
  Lines       15531    15527        -4     
===========================================
+ Hits         7950     9904     +1954     
+ Misses       6513     4385     -2128     
- Partials     1068     1238      +170
Flag Coverage Δ
#criv1alpha1test 33.7% <45.83%> (+0.04%) ⬆️
#criv1alpha2test 34.16% <45.83%> (+0.02%) ⬆️
#integrationtest 38.46% <41.66%> (?)
#unittest 22.2% <56.52%> (+0.2%) ⬆️
Impacted Files Coverage Δ
pkg/netutils/interface.go 95.83% <ø> (ø)
cri/v1alpha1/service/cri.go 84.61% <100%> (+11.28%) ⬆️
apis/server/server.go 52.5% <100%> (+4.3%) ⬆️
cri/v1alpha2/service/cri.go 84.61% <100%> (+11.28%) ⬆️
cri/v1alpha2/cri_stream.go 80% <100%> (ø) ⬆️
cri/v1alpha1/cri_stream.go 80% <100%> (ø) ⬆️
pkg/netutils/listener.go 60.46% <60.46%> (ø)
cri/stream/httpstream/spdy/upgrade.go 54.28% <0%> (-5.72%) ⬇️
cri/v1alpha2/cri.go 65.96% <0%> (-0.18%) ⬇️
... and 75 more

@YaoZengzeng YaoZengzeng force-pushed the net-tools branch 6 times, most recently from 7e8a6be to ead57c2 Compare August 2, 2018 12:03
@YaoZengzeng YaoZengzeng changed the title [WIP]bugfix: move function getListener() to pkg/net/listener.go bugfix: move function getListener() to pkg/net/listener.go Aug 2, 2018
@YaoZengzeng
Copy link
Contributor Author

@fuweid PTAL.


for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := GetListener(tt.args.addr, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

could we close it if the case pass?

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants