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

feat: minio testhelper add content method #524

Merged
merged 2 commits into from
Jun 18, 2024
Merged

feat: minio testhelper add content method #524

merged 2 commits into from
Jun 18, 2024

Conversation

lvrach
Copy link
Member

@lvrach lvrach commented Jun 10, 2024

Description

Add content method to testhelper minio resource, to avoid code repetition in tests.

Linear Ticket

https://linear.app/rudderstack/issue/PIPE-1179/rudder-go-kit-testhelper-miniocontents

resolves PIPE-1179

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@lvrach lvrach marked this pull request as ready for review June 10, 2024 17:23
@lvrach lvrach requested a review from achettyiitr June 11, 2024 09:04
@@ -116,3 +126,46 @@ func Setup(pool *dockertest.Pool, d resource.Cleaner, opts ...func(*Config)) (*R
Client: client,
}, nil
}

func (r *Resource) Contents(ctx context.Context, prefix string) ([]File, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[nitpick] This receiver has a different name than the other one. We could name both r.

Recursive: true,
Prefix: prefix,
}
for objInfo := range r.Client.ListObjects(ctx, r.BucketName, opts) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if the context gets cancelled? Don't we have to check objInfo.Err? 🤔

var r io.Reader
br := bufio.NewReader(o)
magic, err := br.Peek(2)
if err == nil && magic[0] == 31 && magic[1] == 139 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we have a comment here please?

@lvrach lvrach enabled auto-merge (squash) June 18, 2024 07:10
@lvrach lvrach merged commit 201797b into main Jun 18, 2024
10 checks passed
@lvrach lvrach deleted the feat.minio-content branch June 18, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants