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

Added test case for internal/info pacakge. #514

Merged
merged 7 commits into from
Jun 30, 2020
Merged

Conversation

hlts2
Copy link
Contributor

@hlts2 hlts2 commented Jun 24, 2020

Description:

I added a test case for the internal/info package.
However, I'm not able to reach some code because I'm calling runtime.Caller directly.
Therefore, I skipped the tests related to the parts other than initialization.
As a future move, I make runtime.Callder subordinate to another structure and change the implementation code to get the information via the interface. After making the changes, I implement the tests for that part.
The following is target code.
https://github.com/vdaas/vald/blob/master/internal/info/info.go#L153-L160

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.14.3
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.11.5

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 June 24, 2020 06:59
@pull-assistant
Copy link

pull-assistant bot commented Jun 24, 2020

Score: 0.75

Best reviewed: commit by commit


Optimal code review plan

     feat: info pacakge test

     feat: add test case for initialize function

     feat: add go-cmp

     feat: use go-cmp

     fix: test case name

     feat: comment

     Update internal/info/info.go

Powered by Pull Assistant. Last update b1f1d58 ... f41caa8. Read the comment docs.

@hlts2
Copy link
Contributor Author

hlts2 commented Jun 24, 2020

/rebase

@vdaas-ci
Copy link
Collaborator

[REBASE] Rebase triggered by hlts2 for branch: test/internal/info

@codecov
Copy link

codecov bot commented Jun 24, 2020

Codecov Report

Merging #514 into master will increase coverage by 0.16%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #514      +/-   ##
=========================================
+ Coverage    8.86%   9.03%   +0.16%     
=========================================
  Files         402     402              
  Lines       20831   20831              
=========================================
+ Hits         1847    1882      +35     
+ Misses      18731   18696      -35     
  Partials      253     253              
Impacted Files Coverage Δ
internal/info/info.go 29.16% <ø> (+29.16%) ⬆️

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 9e1f1e8...f41caa8. Read the comment docs.

@kevindiu
Copy link
Contributor

@hlts2 Seems some test case is not completed.

@vankichi
Copy link
Contributor

How do you think add error case or default params case?

@hlts2
Copy link
Contributor Author

hlts2 commented Jun 25, 2020

/rebase

@vdaas-ci
Copy link
Collaborator

[REBASE] Rebase triggered by hlts2 for branch: test/internal/info

internal/info/info_test.go Show resolved Hide resolved
internal/info/info_test.go Show resolved Hide resolved
internal/info/info_test.go Show resolved Hide resolved
internal/info/info_test.go Show resolved Hide resolved
internal/info/info_test.go Show resolved Hide resolved
@kevindiu
Copy link
Contributor

Please add comments to info.go.

@kevindiu
Copy link
Contributor

seems testString() and other test is not completed.

@hlts2
Copy link
Contributor Author

hlts2 commented Jun 29, 2020

/rebase

@vdaas-ci
Copy link
Collaborator

[REBASE] Rebase triggered by hlts2 for branch: test/internal/info

@@ -45,6 +46,7 @@ type Detail struct {
PrepOnce sync.Once `json:"-" yaml:"-"`
}

// StackTrace represents stacktrace infomation about url, function name, file, line ..etc.
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 🐶
infomation is a misspelling of information (misspell)

@kevindiu
Copy link
Contributor

/rebase

@kevindiu
Copy link
Contributor

LGTM but please fix #514 (comment) first :)

@vdaas-ci
Copy link
Collaborator

[REBASE] Rebase triggered by kevindiu for branch: test/internal/info

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>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
internal/info/info.go Outdated Show resolved Hide resolved
Co-authored-by: Kevin Diu <kevin_diu@yahoo.com.hk>
Copy link
Contributor

@kevindiu kevindiu left a comment

Choose a reason for hiding this comment

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

LGTM

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

@vankichi
Copy link
Contributor

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

[REBASE] Rebase triggered by vankichi for branch: test/internal/info

@vdaas-ci
Copy link
Collaborator

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

Copy link
Collaborator

@vdaas-ci vdaas-ci left a comment

Choose a reason for hiding this comment

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

[APPROVED] This PR is approved by vankichi.

@vankichi vankichi merged commit 58ac8c1 into master Jun 30, 2020
@vankichi vankichi deleted the test/internal/info branch June 30, 2020 02:51
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