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

Bind testing server to 0.0.0.0 #172

Merged
merged 1 commit into from
Feb 20, 2025
Merged

Bind testing server to 0.0.0.0 #172

merged 1 commit into from
Feb 20, 2025

Conversation

Randgalt
Copy link
Member

Also, use bespoke S3 client for testing

Also, use bespoke S3 client for testing
@cla-bot cla-bot bot added the cla-signed label Feb 20, 2025
@Randgalt Randgalt requested review from mosiac1 and martint February 20, 2025 20:34
delegatingFacade.setDelegate(new PathStyleRemoteS3Facade((_, _) -> httpErrorResponseServer.getBaseUrl().getHost(), false, Optional.of(httpErrorResponseServer.getBaseUrl().getPort())));
}

@AfterEach
Copy link
Member

@martint martint Feb 20, 2025

Choose a reason for hiding this comment

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

Is the constructor invoked once per test? It's not obvious from the test whether it's @TestInstance(PER_CLASS) or @TestInstance(PER_METHOD). I'd suggest annotating the class to make it explicit.

Copy link
Member Author

@Randgalt Randgalt Feb 20, 2025

Choose a reason for hiding this comment

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

@TrinoAwsProxyTest implies per class (and other settings).

@Retention(RUNTIME)
@Target(TYPE)
@Inherited
@ExtendWith(TrinoAwsProxyTestExtension.class)
@TestInstance(PER_CLASS)

Copy link
Member

Choose a reason for hiding this comment

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

Hmm... if its @TestInstance(PER_CLASS), then it's not going to work with this shutdown method, which is going to be called after each individual test. You need to use @AfterAll, instead.

@Randgalt Randgalt merged commit 8b8dba7 into main Feb 20, 2025
2 checks passed
@Randgalt Randgalt deleted the jordanz/bind-to-localhost branch February 20, 2025 21:31
Comment on lines +104 to 108
internalClient = clientBuilder(httpErrorResponseServer.getBaseUrl())
.forcePathStyle(true)
.credentialsProvider(() -> AwsSessionCredentials.create(testingCredentials.emulated().accessKey(), testingCredentials.emulated().secretKey(), testingCredentials.emulated().session().orElse("")))
.build();
delegatingFacade.setDelegate(new PathStyleRemoteS3Facade((_, _) -> httpErrorResponseServer.getBaseUrl().getHost(), false, Optional.of(httpErrorResponseServer.getBaseUrl().getPort())));
Copy link
Contributor

Choose a reason for hiding this comment

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

In this state, this doesn't test anything, right?

The point was to test that aws-proxy propagates errors from the remote S3 correctly.

What this is doing currently is bypassing the aws-proxy and calling httpErrorResponseServer with an S3 client

Copy link
Member Author

Choose a reason for hiding this comment

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

Derp - I messed it up I think. Feel free to submit a fixup PR. I probably didn't understand the test.

mosiac1 added a commit to mosiac1/s3-proxy that referenced this pull request Feb 21, 2025
Changes added in trinodb#172 meant to fix an issue with the IP `createTestingHttpServer` binds on accidentally broke this test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants