From 3cd634035e730dfba8eb1adf98606a0b74af550e Mon Sep 17 00:00:00 2001 From: skrzypo987 Date: Thu, 13 Oct 2022 10:46:25 +0200 Subject: [PATCH] Fix flaky test by using unique bucket name --- .../io/trino/plugin/hive/s3/TestS3WrongRegionPicked.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestS3WrongRegionPicked.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestS3WrongRegionPicked.java index 2d8608c6942c..e1c48c09ba4f 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestS3WrongRegionPicked.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestS3WrongRegionPicked.java @@ -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 + "')"); assertThatThrownBy(() -> queryRunner.execute("SELECT * FROM default." + tableName)) .getRootCause() .hasMessageContaining("Status Code: 400")