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/db/storage/blob/s3/reader. #718

Merged
merged 13 commits into from
Oct 2, 2020

Conversation

hlts2
Copy link
Contributor

@hlts2 hlts2 commented Sep 23, 2020

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

Description:

I refactored and added test fors3/reader.go

Refactor

  • WHY
    I am writing test about s3/reader now. But There were some places where I couldn’t write a test.
    The reason are as follows.
  1. The current implementation calls New method inside test target function.

    body, err = ctxio.NewReaderWithContext(ctx, body)

  2. The current implementation use s3 struct object, not interface

  • WHAT
  1. I want to create io interface to create object via interafce like comress. https://github.com/vdaas/vald/blob/master/internal/compress/lz4/lz4.go#L49
  2. I want to use s3iface.S3API interface instead of s3 struct(*s3.S3)
    https://github.com/aws/aws-sdk-go/blob/v1.34.28/service/s3/s3iface/interface.go#L62-L441
type reader struct {
	service *s3.S3
}
↓
type reader struct {
	service s3iface.S3API
}

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.

@pull-assistant
Copy link

pull-assistant bot commented Sep 23, 2020

Score: 0.96

Best reviewed: commit by commit


Optimal code review plan

     feat: add test

     feat: add test and mock

     feat: add test case

     feat: add comment

     fix: test case

     fix: import path

     feat: add alias for s3

     fix: lint warning

     fix: apply suggestion

     Update internal/db/storage/blob/s3/reader/reader.go

     fix: ci error

     🤖 Update license headers / Format go codes and yaml files

     add pacakge comment

Powered by Pull Assistant. Last update 4b46dd1 ... cc5fbb5. Read the comment docs.

@hlts2 hlts2 self-assigned this Sep 23, 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

@codecov
Copy link

codecov bot commented Sep 23, 2020

Codecov Report

Merging #718 into master will increase coverage by 0.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #718      +/-   ##
==========================================
+ Coverage   15.46%   15.76%   +0.29%     
==========================================
  Files         420      421       +1     
  Lines       19531    19536       +5     
==========================================
+ Hits         3021     3079      +58     
+ Misses      16287    16229      -58     
- Partials      223      228       +5     
Impacted Files Coverage Δ
internal/db/storage/blob/s3/reader/option.go 100.00% <ø> (ø)
internal/db/storage/blob/s3/reader/reader.go 67.44% <100.00%> (+67.44%) ⬆️
internal/db/storage/blob/s3/reader/reader_mock.go 100.00% <100.00%> (ø)
internal/worker/queue.go 95.00% <0.00%> (-5.00%) ⬇️
internal/errgroup/group.go 92.42% <0.00%> (-1.52%) ⬇️
internal/worker/worker.go 83.33% <0.00%> (-1.05%) ⬇️

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 4410fa4...f4ec3e9. Read the comment docs.

@hlts2
Copy link
Contributor Author

hlts2 commented Sep 24, 2020

/rebase

@vdaas-ci
Copy link
Collaborator

[REBASE] Rebase triggered by hlts2 for branch: test/internal/add-test-for-s3-reader

@vdaas-ci vdaas-ci force-pushed the test/internal/add-test-for-s3-reader branch from ea64ee7 to 9da7fac Compare September 24, 2020 06:44
@hlts2 hlts2 changed the title [WIP] Add test for internal/db/storage/blob/s3/reader. Add test for internal/db/storage/blob/s3/reader. Sep 24, 2020
@hlts2 hlts2 requested a review from kevindiu September 24, 2020 07:32
kevindiu
kevindiu previously approved these changes Sep 24, 2020
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

@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.

please fix CI

kevindiu
kevindiu previously approved these changes Sep 24, 2020
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

@hlts2 hlts2 requested a review from vankichi September 30, 2020 04:09
@vankichi
Copy link
Contributor

vankichi commented Oct 1, 2020

/format

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Oct 1, 2020

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

kevindiu
kevindiu previously approved these changes Oct 2, 2020
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

vankichi
vankichi previously approved these changes Oct 2, 2020
@vankichi
Copy link
Contributor

vankichi commented Oct 2, 2020

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Oct 2, 2020

[REBASE] Rebase triggered by vankichi for branch: test/internal/add-test-for-s3-reader

@vdaas-ci vdaas-ci dismissed stale reviews from vankichi and kevindiu via 3ac6c75 October 2, 2020 09:26
@vdaas-ci vdaas-ci force-pushed the test/internal/add-test-for-s3-reader branch from cc5fbb5 to 3ac6c75 Compare October 2, 2020 09:26
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Oct 2, 2020

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

vdaas-ci
vdaas-ci previously approved these changes Oct 2, 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

vankichi commented Oct 2, 2020

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Oct 2, 2020

[REBASE] Rebase triggered by vankichi for branch: test/internal/add-test-for-s3-reader

hlts2 and others added 13 commits October 2, 2020 11:59
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>
Co-authored-by: Kevin Diu <kevindiujp@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

vdaas-ci commented Oct 2, 2020

[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 3caef54 into master Oct 2, 2020
@vankichi vankichi deleted the test/internal/add-test-for-s3-reader branch October 2, 2020 14:36
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