-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix flaky TestS3WrongRegionPicked.testS3WrongRegionSelection #14615
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
Merged
Praveen2112
merged 1 commit into
trinodb:master
from
skrzypo987:skrzypo/126-fix-flaky-s3-test
Oct 14, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,12 +27,15 @@ public class TestS3WrongRegionPicked | |
| public void testS3WrongRegionSelection() | ||
| throws Exception | ||
| { | ||
| try (HiveMinioDataLake dataLake = new HiveMinioDataLake("test-bucket").start(); | ||
| // Bucket names are global so a unique one needs to be used. | ||
| String bucketName = "test-bucket" + randomTableSuffix(); | ||
|
|
||
| try (HiveMinioDataLake dataLake = new HiveMinioDataLake(bucketName).start(); | ||
| QueryRunner queryRunner = S3HiveQueryRunner.builder(dataLake) | ||
| .setHiveProperties(ImmutableMap.of("hive.s3.region", "eu-central-1")) // Different than the default one | ||
| .build()) { | ||
| String tableName = "s3_region_test_" + randomTableSuffix(); | ||
| queryRunner.execute("CREATE TABLE default." + tableName + " (a int) WITH (external_location = 's3://test-bucket/" + tableName + "')"); | ||
| queryRunner.execute("CREATE TABLE default." + tableName + " (a int) WITH (external_location = 's3://" + bucketName + "/" + tableName + "')"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Can we use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually prefer concatenation for trivial cases. |
||
| assertThatThrownBy(() -> queryRunner.execute("SELECT * FROM default." + tableName)) | ||
| .getRootCause() | ||
| .hasMessageContaining("Status Code: 400") | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment on why we need this random bucket name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MinioClienthas something which is calledcreatedBucketswhich is static. Event if we start new Minio container, this will fail to create bucket with same name.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the new minio container, the bucket doesn't exist right ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
MinioClientclass from packageio.trino.testing.miniowe have a set of created buckets (which is persistent and independent of minio container and its buckets). Maybe we should clean this set on close?Edit: If we do this test in loop, same name error will be a thing that will come up as first. I don't know if this is a reason for being flaky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
MinioClientclass is strictly for testing purposes, so forcing a unique bucket naming seems like a good idea. If I had thought about it in the first place, there would be no bug.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would look up on
BackgroundHiveSplitLoaderif it behaves correctly when stopped andloadSplitsis ongoing.