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

Add test case for internal/errors/grpc.go #903

Merged
merged 9 commits into from
Jan 8, 2021

Conversation

hlts2
Copy link
Collaborator

@hlts2 hlts2 commented Dec 28, 2020

Description:

I added the test cases for internal/errors/grpc.go and comments.

And I modified the function name based on kevin-san's comment.

grammar check passed

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.15.2
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.12.1

Types of changes:

  • Bug fix [type/bug]
  • New feature [type/feature]
  • Add tests [type/test]
  • Security related changes [type/security]
  • Add documents [type/documentation]
  • Refactoring [type/refactoring]
  • Update dependencies [type/dependency]
  • Update benchmarks and performances [type/bench]
  • Update CI [type/ci]

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Checklist:

  • I have read the CONTRIBUTING document.
  • I have checked open Pull Requests for the similar feature or fixes?
  • I have added tests and benchmarks to cover my changes.
  • I have ensured all new and existing tests passed.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly.

@hlts2 hlts2 requested a review from kevindiu December 28, 2020 01:47
@hlts2 hlts2 changed the title Add test case for internal/errors/grpc.go [WIP] Add test case for internal/errors/grpc.go Dec 28, 2020
@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 💌 /changelog - add changelog comment
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • /rebase - rebase master

@@ -33,19 +33,24 @@ var (
return Errorf("invalid gRPC client connection to %s", addr)
}

// ErrGRPCLookupIPAddrNotFound represents a function to generate an error that the vald internal gRPC couldn't find ip address.
Copy link
Contributor

Choose a reason for hiding this comment

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

[golangci] reported by reviewdog 🐶
line is 128 characters (lll)

@codecov
Copy link

codecov bot commented Dec 28, 2020

Codecov Report

Merging #903 (7c092fd) into master (5b8cfad) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #903      +/-   ##
==========================================
+ Coverage   19.16%   19.17%   +0.01%     
==========================================
  Files         423      422       -1     
  Lines       19602    19548      -54     
==========================================
- Hits         3756     3749       -7     
+ Misses      15628    15590      -38     
+ Partials      218      209       -9     
Impacted Files Coverage Δ
internal/errors/grpc.go 100.00% <100.00%> (+100.00%) ⬆️
internal/worker/worker.go 82.29% <0.00%> (-1.05%) ⬇️
internal/net/net.go
internal/db/storage/blob/s3/reader/reader.go 97.70% <0.00%> (+32.18%) ⬆️

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 fd20606...cc07abd. Read the comment docs.

@hlts2 hlts2 changed the title [WIP] Add test case for internal/errors/grpc.go Add test case for internal/errors/grpc.go Dec 28, 2020
@github-actions github-actions bot added size/XL and removed size/L labels Dec 28, 2020
internal/errors/grpc.go Outdated Show resolved Hide resolved
internal/errors/grpc.go Outdated Show resolved Hide resolved
@@ -19,33 +19,39 @@ package errors

var (

// gRPC

// ErrgRPCClientConnectionClose represents a function to generate an error that the gRPC connection couldn't close.
ErrgRPCClientConnectionClose = func(name string, err error) error {
Copy link
Contributor

@kevindiu kevindiu Jan 5, 2021

Choose a reason for hiding this comment

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

I think it should be ErrGRPCClientConnectionClose

Copy link
Collaborator Author

@hlts2 hlts2 Jan 5, 2021

Choose a reason for hiding this comment

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

I could not understand your opinion ...
I'm sorry I don't understand.:bow:
so could you please tell me about this more clearly?? 🙇

Does this mean I need to modify the function name? 🤔
I think your opinion's function name(ErrgRPCClientConnectionClose ) and the function name (ErrgRPCClientConnectionClose ) in the original code are the same 🤔
If I made a mistake, I am sorry

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry it was my mistake. I have modified the comment above.

Copy link
Collaborator Author

@hlts2 hlts2 Jan 5, 2021

Choose a reason for hiding this comment

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

thank you. 🙏
But I can not see the modified your comment above...:thinking:
It may not have been modified 🤔
so could you please re-modify it ?? 🙇

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I should describe here.
Here is the suggestion.

Suggested change
ErrgRPCClientConnectionClose = func(name string, err error) error {
ErrGRPCClientConnectionClose = func(name string, err error) error {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thank you. I get it 👍
I will fix it soon 🙏

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this change affect current code?
do you already check?

Copy link
Collaborator Author

@hlts2 hlts2 Jan 5, 2021

Choose a reason for hiding this comment

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

@vankichi
thank you for your comment.

Does this change affect current code?

I think this change does not affect to current code. 🤔

do you already check?

Yes, I did.
I searched for a usage points before, but I couldn't find it.
The following is the searched result 🙇
https://github.com/vdaas/vald/search?q=ErrgRPCClientConnectionClose

@hlts2 hlts2 requested a review from vankichi January 5, 2021 02:24
Copy link
Contributor

@vankichi vankichi left a comment

Choose a reason for hiding this comment

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

@hlts2 leave comment

internal/errors/grpc_test.go Outdated Show resolved Hide resolved
internal/errors/grpc_test.go Outdated Show resolved Hide resolved
type args struct {
addr string
host string
port uint16
Copy link
Contributor

Choose a reason for hiding this comment

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

I thinks it'd be better add case with boundary value of uint16

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for your comment. 🙇
I agree with you. 👍

I selected 0 and maxUint16and 8080 as port value. 🤔
Originally, maxUint16 + 1, -1 should be also included as boundary value, but it could not be included due to a compile error. ...
So could you tell me which value should be selected as the boundary value of uint16?
sorry 🙏

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For example, uint16 range is from 0 to maxUint16 🤔
so, is the boundary value below?

  • 0
  • 1
  • maxUint16-1
  • maxUint16

Copy link
Contributor

Choose a reason for hiding this comment

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

yap

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
Collaborator Author

Choose a reason for hiding this comment

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

@vankichi
thank you

internal/errors/grpc.go Show resolved Hide resolved
internal/errors/grpc.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
internal/errors/grpc_test.go Show resolved Hide resolved
vankichi
vankichi previously approved these changes Jan 6, 2021
Copy link
Contributor

@vankichi vankichi left a comment

Choose a reason for hiding this comment

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

LGTM

@kevindiu
Copy link
Contributor

kevindiu commented Jan 7, 2021

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Jan 7, 2021

[REBASE] Rebase triggered by kevindiu for branch: test/internal/add-errors-grpc-test

hlts2 and others added 8 commits January 7, 2021 01:47
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Co-authored-by: Kiichiro YUKAWA <kyukawa315@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@github-actions github-actions bot force-pushed the test/internal/add-errors-grpc-test branch from b793f54 to aa50a19 Compare January 7, 2021 01:47
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Jan 7, 2021

[FORMAT] Updating license headers and formatting go codes triggered by kevindiu.

@kevindiu
Copy link
Contributor

kevindiu commented Jan 8, 2021

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Jan 8, 2021

[REBASE] Rebase triggered by kevindiu for branch: test/internal/add-errors-grpc-test

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Jan 8, 2021

[FORMAT] Updating license headers and formatting go codes triggered by kevindiu.

@kevindiu kevindiu merged commit 0e93f6b into master Jan 8, 2021
@kevindiu kevindiu deleted the test/internal/add-errors-grpc-test branch January 8, 2021 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants