paths = new ArrayList<>();
+ paths.addAll(listing.getCommonPrefixes());
+ paths.addAll(listing.getObjectSummaries().stream().map(S3ObjectSummary::getKey).collect(toImmutableList()));
+ return paths;
+ }
+}
diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestTrinoS3FileSystemAwsS3.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestTrinoS3FileSystemAwsS3.java
new file mode 100644
index 000000000000..9801ea567be5
--- /dev/null
+++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestTrinoS3FileSystemAwsS3.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.trino.plugin.hive.s3;
+
+import org.apache.hadoop.conf.Configuration;
+import org.testng.annotations.BeforeClass;
+
+import static io.trino.hadoop.ConfigurationInstantiator.newEmptyConfiguration;
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Tests file system operations on AWS S3 storage.
+ *
+ * Requires AWS credentials, which can be provided any way supported by the DefaultProviderChain
+ * See https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default
+ */
+public class TestTrinoS3FileSystemAwsS3
+ extends BaseTestTrinoS3FileSystemObjectStorage
+{
+ private String bucketName;
+ private String s3Endpoint;
+
+ @BeforeClass
+ public void setup()
+ {
+ bucketName = requireNonNull(System.getenv("S3_BUCKET"), "Environment S3_BUCKET was not set");
+ s3Endpoint = requireNonNull(System.getenv("S3_BUCKET_ENDPOINT"), "Environment S3_BUCKET_ENDPOINT was not set");
+ }
+
+ @Override
+ protected String getBucketName()
+ {
+ return bucketName;
+ }
+
+ @Override
+ protected Configuration s3Configuration()
+ {
+ Configuration config = newEmptyConfiguration();
+ config.set("fs.s3.endpoint", s3Endpoint);
+ return config;
+ }
+}
diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestTrinoS3FileSystemMinio.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestTrinoS3FileSystemMinio.java
new file mode 100644
index 000000000000..3a52756ce0fb
--- /dev/null
+++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/s3/TestTrinoS3FileSystemMinio.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.trino.plugin.hive.s3;
+
+import com.amazonaws.services.s3.AmazonS3;
+import com.google.common.collect.ImmutableMap;
+import io.trino.testing.containers.Minio;
+import io.trino.testing.minio.MinioClient;
+import io.trino.util.AutoCloseableCloser;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.net.URI;
+
+import static io.trino.hadoop.ConfigurationInstantiator.newEmptyConfiguration;
+import static io.trino.testing.TestingNames.randomNameSuffix;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.testng.Assert.assertTrue;
+
+public class TestTrinoS3FileSystemMinio
+ extends BaseTestTrinoS3FileSystemObjectStorage
+{
+ public static final String MINIO_ACCESS_KEY = "accesskey";
+ public static final String MINIO_SECRET_KEY = "secretkey";
+
+ private final String bucketName = "trino-ci-test";
+
+ private Minio minio;
+
+ private MinioClient minioClient;
+
+ @BeforeClass
+ public void setup()
+ throws Exception
+ {
+ minio = Minio.builder()
+ .withEnvVars(ImmutableMap.builder()
+ .put("MINIO_ACCESS_KEY", MINIO_ACCESS_KEY)
+ .put("MINIO_SECRET_KEY", MINIO_SECRET_KEY)
+ .buildOrThrow())
+ .build();
+ minio.start();
+
+ minioClient = minio.createMinioClient();
+ minio.createBucket(bucketName);
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown()
+ throws Exception
+ {
+ try (AutoCloseableCloser closer = AutoCloseableCloser.create()) {
+ closer.register(minio);
+ closer.register(minioClient);
+ }
+ minioClient = null;
+ minio = null;
+ }
+
+ @Override
+ protected String getBucketName()
+ {
+ return bucketName;
+ }
+
+ @Override
+ protected Configuration s3Configuration()
+ {
+ Configuration config = newEmptyConfiguration();
+ config.set("trino.s3.endpoint", minio.getMinioAddress());
+ config.set("trino.s3.access-key", MINIO_ACCESS_KEY);
+ config.set("trino.s3.secret-key", MINIO_SECRET_KEY);
+ config.set("trino.s3.path-style-access", "true");
+
+ return config;
+ }
+
+ @Test
+ public void testDeleteNonRecursivelyEmptyBucketRoot()
+ throws Exception
+ {
+ String testBucketName = "trino-delete-bucket-root-empty" + randomNameSuffix();
+ minioClient.makeBucket(testBucketName);
+ String testBucketPath = "s3://%s/".formatted(testBucketName);
+ try (TrinoS3FileSystem fs = new TrinoS3FileSystem()) {
+ fs.initialize(new URI(testBucketPath), s3Configuration());
+
+ AmazonS3 s3 = fs.getS3Client();
+
+ assertThat(listPaths(s3, testBucketName, "", true)).isEmpty();
+
+ fs.delete(new Path(testBucketPath), false);
+
+ assertThat(listPaths(s3, testBucketName, "", true)).isEmpty();
+ }
+ }
+
+ @Test
+ public void testDeleteNonRecursivelyNonEmptyBucketRoot()
+ throws Exception
+ {
+ String testBucketName = "trino-delete-bucket-root-non-empty" + randomNameSuffix();
+ minioClient.makeBucket(testBucketName);
+ String testBucketPath = "s3://%s/".formatted(testBucketName);
+ try (TrinoS3FileSystem fs = new TrinoS3FileSystem()) {
+ fs.initialize(new URI(testBucketPath), s3Configuration());
+
+ AmazonS3 s3 = fs.getS3Client();
+ fs.createNewFile(new Path("s3://%s/file1.txt".formatted(testBucketName)));
+ String directory2Path = testBucketPath + "directory2";
+ createDirectory(fs.getS3Client(), testBucketName, "directory2");
+ String filename2 = "file2.txt";
+ fs.createNewFile(new Path(directory2Path, filename2));
+
+ assertThat(listPaths(s3, testBucketName, "", true))
+ .containsOnly("file1.txt", "directory2/", "directory2/file2.txt");
+
+ assertThatThrownBy(() -> fs.delete(new Path(testBucketPath), false))
+ .hasMessage("Directory %s is not empty".formatted(testBucketPath));
+
+ assertThat(listPaths(s3, testBucketName, "", true))
+ .containsOnly("file1.txt", "directory2/", "directory2/file2.txt");
+ }
+ }
+
+ @Test
+ public void testDeleteRecursivelyBucketRoot()
+ throws Exception
+ {
+ String testBucketName = "trino-delete-recursive-bucket-root" + randomNameSuffix();
+ minioClient.makeBucket(testBucketName);
+ String testBucketPath = "s3://" + testBucketName;
+ try (TrinoS3FileSystem fs = new TrinoS3FileSystem()) {
+ fs.initialize(new URI(testBucketPath), s3Configuration());
+
+ AmazonS3 s3 = fs.getS3Client();
+ fs.createNewFile(new Path("s3://%s/file1.txt".formatted(testBucketName)));
+ String directory2Path = testBucketPath + "/directory2";
+ createDirectory(fs.getS3Client(), testBucketName, "directory2");
+ fs.createNewFile(new Path(directory2Path, "file2.txt"));
+
+ assertThat(listPaths(s3, testBucketName, "", true))
+ .containsOnly("file1.txt", "directory2/", "directory2/file2.txt");
+
+ assertTrue(fs.delete(new Path(testBucketPath + Path.SEPARATOR), true));
+
+ assertThat(listPaths(s3, testBucketName, "", true)).isEmpty();
+ }
+ }
+}
diff --git a/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/suite/SuiteDeltaLakeDatabricks.java b/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/suite/SuiteDeltaLakeDatabricks.java
index ff8b469e3338..7b1c8b8f7bef 100644
--- a/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/suite/SuiteDeltaLakeDatabricks.java
+++ b/testing/trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/suite/SuiteDeltaLakeDatabricks.java
@@ -30,8 +30,6 @@ protected String[] getExcludedTests()
// AWS Glue does not support table renames
"io.trino.tests.product.deltalake.TestHiveAndDeltaLakeRedirect.testDeltaToHiveAlterTable",
"io.trino.tests.product.deltalake.TestHiveAndDeltaLakeRedirect.testHiveToDeltaAlterTable",
- // TODO https://github.com/trinodb/trino/issues/13017
- "io.trino.tests.product.deltalake.TestDeltaLakeDropTableCompatibility.testCreateManagedTableInDeltaDropTableInTrino"
};
}
}
diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java
index 26bbd40404d8..3f090492c0db 100644
--- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java
+++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeDropTableCompatibility.java
@@ -63,6 +63,7 @@ public static Object[][] engineConfigurations()
{TRINO, DELTA, true},
{TRINO, DELTA, false},
{DELTA, TRINO, true},
+ {DELTA, TRINO, false},
{DELTA, DELTA, true},
{DELTA, DELTA, false},
};
@@ -75,14 +76,6 @@ public void testDropTable(Engine creator, Engine dropper, boolean explicitLocati
testDropTableAccuracy(creator, dropper, explicitLocation);
}
- @Test(groups = {DELTA_LAKE_DATABRICKS, DELTA_LAKE_OSS, PROFILE_SPECIFIC_TESTS})
- @Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH)
- public void testCreateManagedTableInDeltaDropTableInTrino()
- {
- //TODO Integrate this method into `engineConfigurations()` data provider method after dealing with https://github.com/trinodb/trino/issues/13017
- testDropTableAccuracy(DELTA, TRINO, false);
- }
-
private void testDropTableAccuracy(Engine creator, Engine dropper, boolean explicitLocation)
{
String schemaName = "test_schema_with_location_" + randomNameSuffix();