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 Cases for UploadToCloudStorage #53

Open
uzaxirr opened this issue Jan 5, 2023 · 12 comments
Open

Add Test Cases for UploadToCloudStorage #53

uzaxirr opened this issue Jan 5, 2023 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@uzaxirr
Copy link
Member

uzaxirr commented Jan 5, 2023

Add Test cases for the function UploadToCloudStorage and all possible functions in utils/upload.go

The cloud provider services needs to be mocked over here (Eg: AWS, GCP and Azure)

@uzaxirr uzaxirr added the bug Something isn't working label Jan 5, 2023
@uzaxirr
Copy link
Member Author

uzaxirr commented Jan 5, 2023

Hey @Shofiya2003
Would you like to work on this?

@Shofiya2003
Copy link
Collaborator

Sure

@uzaxirr
Copy link
Member Author

uzaxirr commented Jan 5, 2023

Sure

Thanksss, Assigning it to you right away!!

@Shofiya2003
Copy link
Collaborator

@uzaxirr @abhi-shek-raj apologies for the delay
will work on it this week

@uzaxirr
Copy link
Member Author

uzaxirr commented Jan 16, 2023

@uzaxirr @abhi-shek-raj apologies for the delay will work on it this week

Not a problem at all!

@Shofiya2003
Copy link
Collaborator

I am using the documentation of every cloud service provider to mock the service in the unit test.
Wrapping my heads around documentation.
Do you have any suggestions for writing tests to mock the cloud services using another go package?
Also, i will have to test the function which extracts the files out of the folders Right?
@uzaxirr

@Shofiya2003
Copy link
Collaborator

I started with aws and am using mock client and created logs for the process to test the service.
Should I create a separate test for every cloud service or try to include the tests in the UploadToCloudStorage function?
@uzaxirr @abhishekraj272

@uzaxirr
Copy link
Member Author

uzaxirr commented Jan 17, 2023

Should I create a separate test for every cloud service or try to include the tests in the UploadToCloudStorage function?

Yes, in this way it will be better to segregate the services and have individual customisation for each if or whenever required

Do you have any suggestions for writing tests to mock the cloud services using another go package?

Checkout this comment, see if you can do something similar.

I will have to test the function which extracts the files out of the folders Right?

I didn't got this one, can you mention the function name please.

@Shofiya2003
Copy link
Collaborator

hey! @uzaxirr
I am trying to create mock for aws upload but mock interface does not have the Upload function we are using. It has the PutObject and MultipartUpload . After reading it seems Upload uses either PutObject or MultipartUpload depending on the size of the upload.
I used pushback request handler to generate the log of upload process using [unit test session of AWS] (https://pkg.go.dev/github.com/aws/aws-sdk-go/awstesting/unit) and then compared this log to the expected log.
I am looking for ways to mock the upload service using https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3iface/#S3API

@Shofiya2003
Copy link
Collaborator

I didn't got this one, can you mention the function name please.

The WalkFunc which extracts the files from the folder path

@Shofiya2003
Copy link
Collaborator

@uzaxirr @abhishekraj272 can we divide this into three issues each for the three cloud storage platform. I completed implementing the tests for aws upload.

@abskrj
Copy link
Member

abskrj commented Feb 6, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants