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

Why are the TestUtils sdk v2 sync clients deprecated? #51

Open
shduke opened this issue Apr 16, 2021 · 3 comments
Open

Why are the TestUtils sdk v2 sync clients deprecated? #51

shduke opened this issue Apr 16, 2021 · 3 comments
Labels
enhancement New feature or request pr-requested

Comments

@shduke
Copy link

shduke commented Apr 16, 2021

The TestUtils class in the awssdkv2 package only has async clients; however, the TestUtils in the deprecated package has sync clients. Is there some historic context/reason why the sync ones were deprecated or weren't ported over to the awssdkv2 package as well? Maybe a compatibility issue or something? I couldn't infer the context from the commit messages.

@whummer
Copy link
Member

whummer commented Apr 28, 2021

Thanks for the pointer @shduke . There is no particular reason for the current state - the sync clients per se are not deprecated, but the current state/layout of the codebase is a result of several refactoring steps in the past (e.g., some utils we moved to CommonUtils.java, and most of the client factory methods were moved into the v1/v2 specific packages).

In general, the code base in this repo has grown quite organically, and hasn't received too much attention in terms of refactoring, reducing code duplication, etc.

If you could add some refactoring and/or migrate some of the sync clients into the v2 package, that would be awesome. Any PRs would be much appreciated! Thanks for your help.

@whummer whummer added enhancement New feature or request pr-requested labels Apr 28, 2021
@kmcgovern-apixio
Copy link

I found a way to be able to utilize localstack when testing with the v2 sync apis. Basically it just overrides the builder methods

        Ec2ClientBuilder mockec2 = Ec2Client.builder().endpointOverride(URI.create(Localstack.INSTANCE.getEndpointEC2()));
        PowerMockito.mockStatic(Ec2Client.class);
        when(Ec2Client.builder()).thenReturn(mockec2); 

then just make sure you annotate appropriately

@PrepareForTest({ Ec2Client.class })

you should be able to override anything exposed though the builder via this method.

@lakkeger
Copy link

Hi! We just wanted to follow up to see whether your issue has been resolved. Were you able to get it working with the latest version of LocalStack? We would appreciate your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pr-requested
Projects
None yet
Development

No branches or pull requests

4 participants