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 for internal/file/watch #526

Merged
merged 11 commits into from
Jul 13, 2020
Merged

Add test for internal/file/watch #526

merged 11 commits into from
Jul 13, 2020

Conversation

hlts2
Copy link
Collaborator

@hlts2 hlts2 commented Jun 29, 2020

Signed-off-by: hlts2 hiroto.funakoshi.hiroto@gmail.com

Description:

I added test case for internal/file/watch

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.

@pull-assistant
Copy link

pull-assistant bot commented Jun 29, 2020

Score: 0.86

Best reviewed: commit by commit


Optimal code review plan (2 warnings)

     feat: add test case

     feat: add test case

     fix: refactor

     feat: add test case

     fix: refactor test case

fix: apply suggestion

...ernal/file/watch/watch_test.go 50% changes removed in fix: apply suggestio...

     fix: apply suggestion

     fix: apply suggestion and add test case

     fix: logic for mac

fix: apply suggestion

internal/file/watch/watch.go 75% changes removed in fix: apply suggestio...

     fix: apply suggestion

Powered by Pull Assistant. Last update bac7350 ... df0bbbc. Read the comment docs.

internal/file/watch/watch_test.go Outdated Show resolved Hide resolved
internal/file/watch/watch_test.go Show resolved Hide resolved
internal/file/watch/watch_test.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 29, 2020

Codecov Report

Merging #526 into master will increase coverage by 2.93%.
The diff coverage is 8.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #526      +/-   ##
==========================================
+ Coverage    7.84%   10.77%   +2.93%     
==========================================
  Files         388      403      +15     
  Lines       19945    20939     +994     
==========================================
+ Hits         1565     2257     +692     
- Misses      18156    18414     +258     
- Partials      224      268      +44     
Impacted Files Coverage Δ
internal/cache/cacher/cacher.go 100.00% <ø> (+100.00%) ⬆️
internal/cache/gache/gache.go 0.00% <0.00%> (ø)
internal/cache/gache/option.go 0.00% <0.00%> (-6.67%) ⬇️
internal/client/discoverer/discover.go 0.00% <0.00%> (ø)
internal/config/blob.go 0.00% <0.00%> (ø)
internal/config/grpc.go 0.00% <0.00%> (ø)
internal/config/log.go 100.00% <ø> (+100.00%) ⬆️
internal/config/mysql.go 100.00% <ø> (+100.00%) ⬆️
internal/config/ngt.go 100.00% <ø> (+100.00%) ⬆️
internal/config/observability.go 0.00% <0.00%> (ø)
... and 150 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 0c0505e...df0bbbc. Read the comment docs.

@hlts2 hlts2 changed the title [WIP] add test for internal/file/watch [WIP] [draft] add test for internal/file/watch Jun 30, 2020
@hlts2
Copy link
Collaborator Author

hlts2 commented Jun 30, 2020

/rebase

@vdaas-ci
Copy link
Collaborator

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

@github-actions github-actions bot added size/XL and removed size/L labels Jun 30, 2020
@hlts2
Copy link
Collaborator Author

hlts2 commented Jun 30, 2020

/rebase

@vdaas-ci
Copy link
Collaborator

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

@github-actions github-actions bot added size/XXL and removed size/XL labels Jul 1, 2020
@hlts2
Copy link
Collaborator Author

hlts2 commented Jul 6, 2020

/rebase

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Jul 6, 2020

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

@hlts2 hlts2 changed the title [WIP] [draft] add test for internal/file/watch [draft] add test for internal/file/watch Jul 6, 2020
@kevindiu
Copy link
Contributor

kevindiu commented Jul 6, 2020

do we need author review for this PR?

@hlts2
Copy link
Collaborator Author

hlts2 commented Jul 6, 2020

@kevindiu

do we need author review for this PR?

I don't think it is necessary.
Because I wrote code with @kpango (pair programming).

@hlts2 hlts2 marked this pull request as ready for review July 6, 2020 06:27
@hlts2 hlts2 changed the title [draft] add test for internal/file/watch Add test for internal/file/watch Jul 6, 2020
@kevindiu
Copy link
Contributor

kevindiu commented Jul 6, 2020

@kevindiu

do we need author review for this PR?

I don't think it is necessary.
Because I wrote code with @kpango (pair programming).

OK!

@hlts2 hlts2 requested a review from vankichi July 9, 2020 08:59
Comment on lines +74 to +77
dirs := make([]string, 0, len(w.dirs))
for d := range w.dirs {
dirs = append(dirs, d)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

let me tell about why, please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure.
map type is reference type in golang.
so Even if we take the lock w.dirs, it changes when the referrer changes.
When we copy the value of w.dirs, the instantaneous state is copied, so even if the referrer changes, the copy is not affected.

Comment on lines +155 to +158
iw, err := w.init()
if err == nil {
w = iw
}
Copy link
Contributor

Choose a reason for hiding this comment

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

same. Please tell me the reason.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure.
if w.init returns error, w become nil.
and when roop continues, nil pointer exception will occur.

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/file_watch

@vdaas-ci
Copy link
Collaborator

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

vdaas-ci
vdaas-ci previously approved these changes Jul 10, 2020
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
Copy link
Contributor

@hlts2
When you update some logics, please mention about that and author review is required or not at the PR description field.

@vankichi
Copy link
Contributor

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

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

hlts2 added 11 commits July 13, 2020 00:41
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>
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>
@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 634e3e5 into master Jul 13, 2020
@vankichi vankichi deleted the test/internal/file_watch branch July 13, 2020 00:58
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