Skip to content

Conversation

ashika112
Copy link
Contributor

@ashika112 ashika112 commented Jul 9, 2024

Description of changes

  • Update the common options to include bucket
  • Update test cases to test bucket as string and object
  • This PR includes changes for all API except Copy which will be followed up separately.

Description of how you validated changes

  • New unit tests added
  • Manual testing

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ashika112 ashika112 marked this pull request as ready for review July 15, 2024 17:20
@ashika112 ashika112 changed the title Update/common options [Multi-bucket] Update options to include bucket Jul 15, 2024
Copy link
Member

@HuiSF HuiSF left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines +129 to +130
bucket: apiOptions.bucket.bucketName,
region: apiOptions.bucket.region,
Copy link
Member

Choose a reason for hiding this comment

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

Sanity check: doesn't need to validate the object shape?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didnt think we checked object structure like that? Do we do this somewhere. I thought usually type is enough.

We do have assertion already if there is no bucket or region in our code that is checked after this piece of code.

@@ -220,6 +222,70 @@ describe('downloadData with key', () => {
}),
);
});

describe('bucket passed in options', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding additional tests.

One thought here is that the bucket info overriding is carried by the function resolveS3ConfigAndInput.ts should we primarily test this function, and verify whether other consumer functions are invoking this function correctly, so we don't need to repeat the same tests in every test suite (as they are basically testing the resolveS3ConfigAndInput function)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So couple of pointers here, i think what called out makes sense.

  1. I still have not made changes to COPY api which needs resolution in both source and destination. Per design we might end up extracting resolveBucketConfig logic out and make it per API level if something pops out from Copy implement so for now i have it top level since that makes most sense. So i wrote the test per APi level so if we make the change it can catch any changes.

  2. We will still need test APi level here but rather in that case will check if API options is passed right. I think both of these achieve the same result in my mind.

That said, with next PR on copy API if this still stays here i can add in test specific to that function to check high level. But i think it is still beneficial per API level as well. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big deal, but is there a way to compose this such that the same logic can be re-used between suites?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah i thought about it but we kinda do this in all test suites. Also, i see value in testing this API level like we are doing other places. let me take another look at this. All of these are testing their input on actual s3 call , so i think even if we compose we still need to pass that part in

Copy link
Contributor

@jimblanc jimblanc left a comment

Choose a reason for hiding this comment

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

Looking pretty good to me, few questions & nits

@@ -220,6 +222,70 @@ describe('downloadData with key', () => {
}),
);
});

describe('bucket passed in options', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big deal, but is there a way to compose this such that the same logic can be re-used between suites?

@ashika112 ashika112 merged commit 9073217 into aws-amplify:feat/multi-bucket Jul 18, 2024
@ashika112 ashika112 deleted the update/commonOptions branch July 18, 2024 16:40
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.

4 participants