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/ngt.go #936

Merged
merged 10 commits into from
Feb 2, 2021

Conversation

hlts2
Copy link
Contributor

@hlts2 hlts2 commented Jan 20, 2021

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

Description:

I added the test cases for internal/errors/ngt.go and comments and refactored implementation code.

refactor

I changed from Errorf to New
And I searched for code that uses this implementation.
According to the results of the investigation, this fix had no effect.
https://github.com/vdaas/vald/search?q=ErrUUIDNotFound

The following is a handler that uses insert and delete in the above result, but it is not affected by the wording correction.

handler of Insert

handler of Delete

grammar check passed

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.15.6
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.12.3

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 self-assigned this Jan 20, 2021
@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

internal/errors/ngt.go Outdated Show resolved Hide resolved
internal/errors/ngt.go Outdated Show resolved Hide resolved
@hlts2 hlts2 changed the title Add test case for internal/errors/ngt.go [WIP] Add test case for internal/errors/ngt.go Jan 20, 2021
@codecov
Copy link

codecov bot commented Jan 20, 2021

Codecov Report

Merging #936 (4e1b69d) into master (f8abd67) will increase coverage by 0.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #936      +/-   ##
==========================================
+ Coverage   15.18%   15.34%   +0.16%     
==========================================
  Files         493      493              
  Lines       25683    25683              
==========================================
+ Hits         3900     3942      +42     
+ Misses      21533    21491      -42     
  Partials      250      250              
Impacted Files Coverage Δ
internal/errors/vald.go 100.00% <ø> (+100.00%) ⬆️
internal/errors/ngt.go 94.11% <100.00%> (+94.11%) ⬆️
internal/worker/worker.go 83.33% <0.00%> (+1.04%) ⬆️
internal/errgroup/group.go 93.93% <0.00%> (+1.51%) ⬆️
internal/errors/errors.go 37.50% <0.00%> (+1.56%) ⬆️
internal/worker/queue.go 100.00% <0.00%> (+5.00%) ⬆️

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 956e00c...4c15234. Read the comment docs.

@github-actions github-actions bot added size/XXL and removed size/S labels Jan 25, 2021
}

func TestErrInvalidDimensionSize(t *testing.T) {

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 🐶
File is not gofumpt-ed (gofumpt)

internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
ErrDimensionLimitExceed = func(current, limit int) error {
return Errorf("supported dimension limit exceed:\trequired = %d,\tlimit = %d", current, limit)
}

// ErrIncompatibleDimensionSize represents a function to generate an error that the incompatible dimension size detected.
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 122 characters (lll)

@hlts2 hlts2 requested a review from vankichi January 25, 2021 05:46
@hlts2 hlts2 marked this pull request as ready for review January 25, 2021 05:46
@hlts2 hlts2 changed the title [WIP] Add test case for internal/errors/ngt.go Add test case for internal/errors/ngt.go Jan 25, 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.

please check these suggestion

internal/errors/ngt.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
internal/errors/ngt_test.go Outdated Show resolved Hide resolved
ErrObjectNotFound = func(err error, uuid string) error {
return Wrapf(err, "ngt uuid %s's object not found", uuid)
}

// ErrRemoveRequestedBeforeIndexing represents a function to generate an error that the object is not indexed so can not remove it.
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 132 characters (lll)

limit: int(math.MinInt64),
},
want: want{
want: Errorf("dimension size %d is invalid, the supporting dimension size must be between 2 ~ %d", int(math.MinInt64), int(math.MinInt64)),
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 143 characters (lll)

limit: int(math.MaxInt64),
},
want: want{
want: Errorf("dimension size %d is invalid, the supporting dimension size must be between 2 ~ %d", int(math.MaxInt64), int(math.MaxInt64)),
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 143 characters (lll)

vankichi
vankichi previously approved these changes Jan 29, 2021
kevindiu
kevindiu previously approved these changes Feb 1, 2021
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

@kevindiu
Copy link
Contributor

kevindiu commented Feb 1, 2021

/format
/rebase
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@vdaas-ci vdaas-ci dismissed stale reviews from kevindiu and vankichi via db2366f February 1, 2021 09:34
@vdaas-ci vdaas-ci force-pushed the test/internal/add-newtest-for-errors-ngt branch from 6e53298 to db2366f Compare February 1, 2021 09:34
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@kevindiu
Copy link
Contributor

kevindiu commented Feb 1, 2021

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@vdaas-ci vdaas-ci force-pushed the test/internal/add-newtest-for-errors-ngt branch from 7dd4e37 to b332e24 Compare February 1, 2021 09:46
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@kevindiu
Copy link
Contributor

kevindiu commented Feb 1, 2021

/rebase
/format
/approve

limit: int(math.MinInt64),
},
want: want{
want: Errorf("supported dimension limit exceed:\trequired = %d,\tlimit = %d", int(math.MinInt64), int(math.MinInt64)),
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 122 characters (lll)

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@vdaas-ci vdaas-ci force-pushed the test/internal/add-newtest-for-errors-ngt branch from b332e24 to 570383b Compare February 1, 2021 09:56
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@kevindiu
Copy link
Contributor

kevindiu commented Feb 1, 2021

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@vdaas-ci vdaas-ci force-pushed the test/internal/add-newtest-for-errors-ngt branch from 8a58944 to 76d596b Compare February 1, 2021 22:45
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 1, 2021

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

@kevindiu
Copy link
Contributor

kevindiu commented Feb 2, 2021

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 2, 2021

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

hlts2 and others added 10 commits February 2, 2021 02:08
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>
@vdaas-ci vdaas-ci force-pushed the test/internal/add-newtest-for-errors-ngt branch from 76d596b to 4c15234 Compare February 2, 2021 02:08
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 2, 2021

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

@kevindiu kevindiu merged commit c5d78e1 into master Feb 2, 2021
@kevindiu kevindiu deleted the test/internal/add-newtest-for-errors-ngt branch February 2, 2021 02:12
@vdaas-ci vdaas-ci mentioned this pull request Feb 2, 2021
11 tasks
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