This is an automated email from the ASF dual-hosted git repository.

etudenhoefner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new 013d09e473 Spark 3.4: Migrate ExtensionsTestBase-related remaining 
tests (#12813)
013d09e473 is described below

commit 013d09e473faada1a3b21c155964ec4d1254d69d
Author: Tom Tanaka <[email protected]>
AuthorDate: Wed Apr 16 23:51:46 2025 +0900

    Spark 3.4: Migrate ExtensionsTestBase-related remaining tests (#12813)
---
 .../spark/extensions/SparkExtensionsTestBase.java  |  71 --------
 .../extensions/TestRewriteTablePathProcedure.java  |  94 +++++-----
 .../spark/extensions/TestSparkExecutorCache.java   |  38 ++--
 .../apache/iceberg/spark/extensions/TestViews.java | 201 +++++++++++----------
 .../extensions/TestRewriteTablePathProcedure.java  |  13 +-
 5 files changed, 172 insertions(+), 245 deletions(-)

diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/SparkExtensionsTestBase.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/SparkExtensionsTestBase.java
deleted file mode 100644
index 4f137f5b8d..0000000000
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/SparkExtensionsTestBase.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 org.apache.iceberg.spark.extensions;
-
-import static org.apache.hadoop.hive.conf.HiveConf.ConfVars.METASTOREURIS;
-
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.ThreadLocalRandom;
-import org.apache.iceberg.CatalogUtil;
-import org.apache.iceberg.hive.HiveCatalog;
-import org.apache.iceberg.hive.TestHiveMetastore;
-import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
-import org.apache.iceberg.spark.SparkCatalogTestBase;
-import org.apache.iceberg.spark.SparkTestBase;
-import org.apache.spark.sql.SparkSession;
-import org.apache.spark.sql.internal.SQLConf;
-import org.junit.BeforeClass;
-
-public abstract class SparkExtensionsTestBase extends SparkCatalogTestBase {
-
-  private static final Random RANDOM = ThreadLocalRandom.current();
-
-  public SparkExtensionsTestBase(
-      String catalogName, String implementation, Map<String, String> config) {
-    super(catalogName, implementation, config);
-  }
-
-  @BeforeClass
-  public static void startMetastoreAndSpark() {
-    SparkTestBase.metastore = new TestHiveMetastore();
-    metastore.start();
-    SparkTestBase.hiveConf = metastore.hiveConf();
-
-    SparkTestBase.spark =
-        SparkSession.builder()
-            .master("local[2]")
-            .config("spark.testing", "true")
-            .config(SQLConf.PARTITION_OVERWRITE_MODE().key(), "dynamic")
-            .config("spark.sql.extensions", 
IcebergSparkSessionExtensions.class.getName())
-            .config("spark.hadoop." + METASTOREURIS.varname, 
hiveConf.get(METASTOREURIS.varname))
-            .config("spark.sql.shuffle.partitions", "4")
-            
.config("spark.sql.hive.metastorePartitionPruningFallbackOnException", "true")
-            
.config("spark.sql.legacy.respectNullabilityInTextDatasetConversion", "true")
-            .config(
-                SQLConf.ADAPTIVE_EXECUTION_ENABLED().key(), 
String.valueOf(RANDOM.nextBoolean()))
-            .enableHiveSupport()
-            .getOrCreate();
-
-    SparkTestBase.catalog =
-        (HiveCatalog)
-            CatalogUtil.loadCatalog(
-                HiveCatalog.class.getName(), "hive", ImmutableMap.of(), 
hiveConf);
-  }
-}
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
index ae82cf5961..4a8b5cfc3e 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
@@ -20,52 +20,47 @@ package org.apache.iceberg.spark.extensions;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.atIndex;
 
+import java.nio.file.Path;
 import java.util.List;
-import java.util.Map;
 import org.apache.iceberg.HasTableOperations;
+import org.apache.iceberg.ParameterizedTestExtension;
 import org.apache.iceberg.RewriteTablePathUtil;
 import org.apache.iceberg.Table;
+import org.apache.iceberg.TableUtil;
 import org.apache.spark.sql.AnalysisException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-public class TestRewriteTablePathProcedure extends SparkExtensionsTestBase {
-  @Rule public TemporaryFolder temp = new TemporaryFolder();
-
-  public String staging = null;
-  public String targetTableDir = null;
-
-  public TestRewriteTablePathProcedure(
-      String catalogName, String implementation, Map<String, String> config) {
-    super(catalogName, implementation, config);
-  }
-
-  @Before
-  public void setupTableLocation() throws Exception {
-    this.staging = temp.newFolder("staging").toURI().toString();
-    this.targetTableDir = temp.newFolder("targetTable").toURI().toString();
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.io.TempDir;
+
+@ExtendWith(ParameterizedTestExtension.class)
+public class TestRewriteTablePathProcedure extends ExtensionsTestBase {
+  @TempDir private Path staging;
+  @TempDir private Path targetTableDir;
+
+  @BeforeEach
+  public void setupTableLocation() {
     sql("CREATE TABLE %s (id bigint NOT NULL, data string) USING iceberg", 
tableName);
   }
 
-  @After
+  @AfterEach
   public void removeTables() {
     sql("DROP TABLE IF EXISTS %s", tableName);
   }
 
-  @Test
+  @TestTemplate
   public void testRewriteTablePathWithPositionalArgument() {
+    String location = targetTableDir.toFile().toURI().toString();
     Table table = validationCatalog.loadTable(tableIdent);
-    String metadataJson =
-        (((HasTableOperations) 
table).operations()).current().metadataFileLocation();
+    String metadataJson = TableUtil.metadataFileLocation(table);
 
     List<Object[]> result =
         sql(
             "CALL %s.system.rewrite_table_path('%s', '%s', '%s')",
-            catalogName, tableIdent, table.location(), targetTableDir);
+            catalogName, tableIdent, table.location(), location);
     assertThat(result).hasSize(1);
     assertThat(result.get(0)[0])
         .as("Should return correct latest version")
@@ -78,18 +73,18 @@ public class TestRewriteTablePathProcedure extends 
SparkExtensionsTestBase {
     checkFileListLocationCount((String) result.get(0)[1], 1);
   }
 
-  @Test
+  @TestTemplate
   public void testRewriteTablePathWithNamedArgument() {
     Table table = validationCatalog.loadTable(tableIdent);
-    String v0Metadata =
-        RewriteTablePathUtil.fileName(
-            (((HasTableOperations) 
table).operations()).current().metadataFileLocation());
+    String v0Metadata = 
RewriteTablePathUtil.fileName(TableUtil.metadataFileLocation(table));
     sql("INSERT INTO TABLE %s VALUES (1, 'a')", tableName);
     String v1Metadata =
         RewriteTablePathUtil.fileName(
             (((HasTableOperations) 
table).operations()).refresh().metadataFileLocation());
 
-    String expectedFileListLocation = staging + "file-list";
+    String targetLocation = targetTableDir.toFile().toURI().toString();
+    String stagingLocation = staging.toFile().toURI().toString();
+    String expectedFileListLocation = stagingLocation + "file-list";
 
     List<Object[]> result =
         sql(
@@ -102,21 +97,24 @@ public class TestRewriteTablePathProcedure extends 
SparkExtensionsTestBase {
                 + "staging_location => '%s')",
             catalogName,
             tableIdent,
-            this.targetTableDir,
+            targetLocation,
             table.location(),
             v1Metadata,
             v0Metadata,
-            this.staging);
-    assertThat(result).hasSize(1);
-    assertThat(result.get(0)[0]).as("Should return correct latest 
version").isEqualTo(v1Metadata);
-    assertThat(result.get(0)[1])
-        .as("Should return correct file_list_location")
-        .isEqualTo(expectedFileListLocation);
+            stagingLocation);
+    assertThat(result)
+        .singleElement()
+        .satisfies(
+            objects -> {
+              assertThat(objects).contains(v1Metadata, atIndex(0));
+              assertThat(objects).contains(expectedFileListLocation, 
atIndex(1));
+            });
     checkFileListLocationCount((String) result.get(0)[1], 4);
   }
 
-  @Test
+  @TestTemplate
   public void testProcedureWithInvalidInput() {
+    String targetLocation = targetTableDir.toFile().toURI().toString();
 
     assertThatThrownBy(
             () -> sql("CALL %s.system.rewrite_table_path('%s')", catalogName, 
tableIdent))
@@ -126,21 +124,19 @@ public class TestRewriteTablePathProcedure extends 
SparkExtensionsTestBase {
             () ->
                 sql(
                     "CALL %s.system.rewrite_table_path('%s','%s')",
-                    catalogName, tableIdent, this.targetTableDir))
+                    catalogName, tableIdent, targetLocation))
         .isInstanceOf(AnalysisException.class)
         .hasMessageContaining("Missing required parameters: [target_prefix]");
     assertThatThrownBy(
             () ->
                 sql(
                     "CALL %s.system.rewrite_table_path('%s', '%s','%s')",
-                    catalogName, "notExists", this.targetTableDir, 
this.targetTableDir))
+                    catalogName, "notExists", targetLocation, targetLocation))
         .isInstanceOf(RuntimeException.class)
         .hasMessageContaining("Couldn't load table");
 
     Table table = validationCatalog.loadTable(tableIdent);
-    String v0Metadata =
-        RewriteTablePathUtil.fileName(
-            (((HasTableOperations) 
table).operations()).current().metadataFileLocation());
+    String v0Metadata = 
RewriteTablePathUtil.fileName(TableUtil.metadataFileLocation(table));
     assertThatThrownBy(
             () ->
                 sql(
@@ -149,11 +145,7 @@ public class TestRewriteTablePathProcedure extends 
SparkExtensionsTestBase {
                         + "source_prefix => '%s', "
                         + "target_prefix => '%s', "
                         + "start_version => '%s')",
-                    catalogName,
-                    tableIdent,
-                    table.location(),
-                    this.targetTableDir,
-                    "v20.metadata.json"))
+                    catalogName, tableIdent, table.location(), targetLocation, 
"v20.metadata.json"))
         .isInstanceOf(IllegalArgumentException.class)
         .hasMessageContaining(
             "Cannot find provided version file %s in metadata log.", 
"v20.metadata.json");
@@ -169,7 +161,7 @@ public class TestRewriteTablePathProcedure extends 
SparkExtensionsTestBase {
                     catalogName,
                     tableIdent,
                     table.location(),
-                    this.targetTableDir,
+                    targetLocation,
                     v0Metadata,
                     "v11.metadata.json"))
         .isInstanceOf(IllegalArgumentException.class)
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSparkExecutorCache.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSparkExecutorCache.java
index ed06857359..382f0ff74e 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSparkExecutorCache.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSparkExecutorCache.java
@@ -38,6 +38,8 @@ import org.apache.iceberg.DataFile;
 import org.apache.iceberg.DeleteFile;
 import org.apache.iceberg.FileScanTask;
 import org.apache.iceberg.Files;
+import org.apache.iceberg.ParameterizedTestExtension;
+import org.apache.iceberg.Parameters;
 import org.apache.iceberg.RowLevelOperationMode;
 import org.apache.iceberg.Schema;
 import org.apache.iceberg.Table;
@@ -67,12 +69,13 @@ import org.apache.spark.sql.Encoders;
 import org.apache.spark.sql.Row;
 import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;
 import org.apache.spark.storage.memory.MemoryStore;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
-public class TestSparkExecutorCache extends SparkExtensionsTestBase {
+@ExtendWith(ParameterizedTestExtension.class)
+public class TestSparkExecutorCache extends ExtensionsTestBase {
 
   @Parameters(name = "catalogName = {0}, implementation = {1}, config = {2}")
   public static Object[][] parameters() {
@@ -99,31 +102,26 @@ public class TestSparkExecutorCache extends 
SparkExtensionsTestBase {
   private String targetTableName;
   private TableIdentifier targetTableIdent;
 
-  public TestSparkExecutorCache(
-      String catalogName, String implementation, Map<String, String> config) {
-    super(catalogName, implementation, config);
-  }
-
-  @Before
+  @BeforeEach
   public void configureTargetTableName() {
     String name = "target_exec_cache_" + JOB_COUNTER.incrementAndGet();
     this.targetTableName = tableName(name);
     this.targetTableIdent = TableIdentifier.of(Namespace.of("default"), name);
   }
 
-  @After
+  @AfterEach
   public void releaseResources() {
     sql("DROP TABLE IF EXISTS %s", targetTableName);
     sql("DROP TABLE IF EXISTS %s", UPDATES_VIEW_NAME);
     INPUT_FILES.clear();
   }
 
-  @Test
+  @TestTemplate
   public void testCopyOnWriteDelete() throws Exception {
     checkDelete(COPY_ON_WRITE);
   }
 
-  @Test
+  @TestTemplate
   public void testMergeOnReadDelete() throws Exception {
     checkDelete(MERGE_ON_READ);
   }
@@ -148,12 +146,12 @@ public class TestSparkExecutorCache extends 
SparkExtensionsTestBase {
         sql("SELECT * FROM %s ORDER BY id ASC", targetTableName));
   }
 
-  @Test
+  @TestTemplate
   public void testCopyOnWriteUpdate() throws Exception {
     checkUpdate(COPY_ON_WRITE);
   }
 
-  @Test
+  @TestTemplate
   public void testMergeOnReadUpdate() throws Exception {
     checkUpdate(MERGE_ON_READ);
   }
@@ -181,12 +179,12 @@ public class TestSparkExecutorCache extends 
SparkExtensionsTestBase {
         sql("SELECT * FROM %s ORDER BY id ASC", targetTableName));
   }
 
-  @Test
+  @TestTemplate
   public void testCopyOnWriteMerge() throws Exception {
     checkMerge(COPY_ON_WRITE);
   }
 
-  @Test
+  @TestTemplate
   public void testMergeOnReadMerge() throws Exception {
     checkMerge(MERGE_ON_READ);
   }
@@ -282,13 +280,13 @@ public class TestSparkExecutorCache extends 
SparkExtensionsTestBase {
       deletes.add(delete.copy(col, value));
     }
 
-    OutputFile out = Files.localOutput(temp.newFile("eq-deletes-" + 
UUID.randomUUID()));
+    OutputFile out = Files.localOutput(new File(temp.toFile(), "eq-deletes-" + 
UUID.randomUUID()));
     return FileHelpers.writeDeleteFile(table, out, null, deletes, 
deleteSchema);
   }
 
   private Pair<DeleteFile, CharSequenceSet> writePosDeletes(
       Table table, List<Pair<CharSequence, Long>> deletes) throws IOException {
-    OutputFile out = Files.localOutput(temp.newFile("pos-deletes-" + 
UUID.randomUUID()));
+    OutputFile out = Files.localOutput(new File(temp.toFile(), "pos-deletes-" 
+ UUID.randomUUID()));
     return FileHelpers.writeDeleteFile(table, out, null, deletes);
   }
 
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java
index bcb0991d1d..7f2f4fd1f8 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java
@@ -23,16 +23,17 @@ import static 
org.assertj.core.api.Assertions.assertThatNoException;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.assertj.core.api.Assumptions.assumeThat;
 
-import java.io.IOException;
+import java.nio.file.Paths;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map;
 import java.util.Random;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import org.apache.iceberg.CatalogProperties;
 import org.apache.iceberg.CatalogUtil;
 import org.apache.iceberg.IcebergBuild;
+import org.apache.iceberg.ParameterizedTestExtension;
+import org.apache.iceberg.Parameters;
 import org.apache.iceberg.Schema;
 import org.apache.iceberg.catalog.Catalog;
 import org.apache.iceberg.catalog.Namespace;
@@ -58,18 +59,21 @@ import org.apache.spark.sql.Row;
 import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;
 import org.apache.spark.sql.catalyst.catalog.SessionCatalog;
 import org.assertj.core.api.InstanceOfAssertFactories;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
-public class TestViews extends SparkExtensionsTestBase {
+@ExtendWith(ParameterizedTestExtension.class)
+public class TestViews extends ExtensionsTestBase {
   private static final Namespace NAMESPACE = Namespace.of("default");
   private static final String SPARK_CATALOG = "spark_catalog";
   private final String tableName = "table";
 
-  @Before
+  @BeforeEach
+  @Override
   public void before() {
+    super.before();
     spark.conf().set("spark.sql.defaultCatalog", catalogName);
     sql("USE %s", catalogName);
     sql("CREATE NAMESPACE IF NOT EXISTS %s", NAMESPACE);
@@ -79,13 +83,17 @@ public class TestViews extends SparkExtensionsTestBase {
     sql("USE %s.%s", catalogName, NAMESPACE);
   }
 
-  @After
+  @AfterEach
   public void removeTable() {
     sql("USE %s", catalogName);
     sql("DROP TABLE IF EXISTS %s.%s", NAMESPACE, tableName);
+
+    // reset spark session catalog
+    spark.sessionState().catalogManager().reset();
+    spark.conf().unset("spark.sql.catalog.spark_catalog");
   }
 
-  @Parameterized.Parameters(name = "catalogName = {0}, implementation = {1}, 
config = {2}")
+  @Parameters(name = "catalogName = {0}, implementation = {1}, config = {2}")
   public static Object[][] parameters() {
     return new Object[][] {
       {
@@ -98,17 +106,13 @@ public class TestViews extends SparkExtensionsTestBase {
         SparkCatalogConfig.SPARK_SESSION_WITH_VIEWS.implementation(),
         ImmutableMap.builder()
             .putAll(SparkCatalogConfig.SPARK_SESSION_WITH_VIEWS.properties())
-            .put(CatalogProperties.URI, REST_SERVER_RULE.uri())
+            .put(CatalogProperties.URI, 
restCatalog.properties().get(CatalogProperties.URI))
             .build()
       }
     };
   }
 
-  public TestViews(String catalog, String implementation, Map<String, String> 
properties) {
-    super(catalog, implementation, properties);
-  }
-
-  @Test
+  @TestTemplate
   public void readFromView() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("simpleView");
@@ -134,7 +138,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrderElementsOf(expected);
   }
 
-  @Test
+  @TestTemplate
   public void readFromTrinoView() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("trinoView");
@@ -159,7 +163,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrderElementsOf(expected);
   }
 
-  @Test
+  @TestTemplate
   public void readFromMultipleViews() throws NoSuchTableException {
     insertRows(6);
     String viewName = viewName("firstView");
@@ -192,7 +196,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrder(row(4), row(5), row(6));
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewUsingNonExistingTable() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewWithNonExistingTable");
@@ -216,7 +220,7 @@ public class TestViews extends SparkExtensionsTestBase {
                 catalogName, NAMESPACE));
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewUsingNonExistingTableColumn() throws 
NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewWithNonExistingColumn");
@@ -238,7 +242,7 @@ public class TestViews extends SparkExtensionsTestBase {
             "A column or function parameter with name `non_existing` cannot be 
resolved");
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewUsingInvalidSQL() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewWithInvalidSQL");
@@ -260,7 +264,7 @@ public class TestViews extends SparkExtensionsTestBase {
             String.format("Invalid view text: invalid SQL. The view %s", 
viewName));
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewWithStaleSchema() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("staleView");
@@ -286,7 +290,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("A column or function parameter with name `data` 
cannot be resolved");
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewHiddenByTempView() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewHiddenByTempView");
@@ -313,7 +317,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrderElementsOf(expected);
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewWithGlobalTempView() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewWithGlobalTempView");
@@ -343,7 +347,7 @@ public class TestViews extends SparkExtensionsTestBase {
             IntStream.rangeClosed(6, 
10).mapToObj(this::row).collect(Collectors.toList()));
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewReferencingAnotherView() throws NoSuchTableException 
{
     insertRows(10);
     String firstView = viewName("viewBeingReferencedInAnotherView");
@@ -374,7 +378,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactly(row(5));
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewReferencingTempView() throws NoSuchTableException {
     insertRows(10);
     String tempView = viewName("tempViewBeingReferencedInAnotherView");
@@ -410,7 +414,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("cannot be found");
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewReferencingAnotherViewHiddenByTempView() throws 
NoSuchTableException {
     insertRows(10);
     String innerViewName = viewName("inner_view");
@@ -458,7 +462,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrderElementsOf(expectedViewRows);
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewReferencingGlobalTempView() throws 
NoSuchTableException {
     insertRows(10);
     String globalTempView = viewName("globalTempViewBeingReferenced");
@@ -496,7 +500,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("cannot be found");
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewReferencingTempFunction() throws 
NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewReferencingTempFunction");
@@ -537,7 +541,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageStartingWith(expectedErrorMsg);
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewWithCTE() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewWithCTE");
@@ -560,7 +564,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SELECT * FROM %s", 
viewName)).hasSize(1).containsExactly(row(10, 1L));
   }
 
-  @Test
+  @TestTemplate
   public void readFromViewWithGroupByOrdinal() throws NoSuchTableException {
     insertRows(3);
     insertRows(2);
@@ -582,7 +586,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrder(row(1, 2L), row(2, 2L), row(3, 1L));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithGroupByOrdinal() throws NoSuchTableException {
     insertRows(3);
     insertRows(2);
@@ -594,7 +598,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrder(row(1, 2L), row(2, 2L), row(3, 1L));
   }
 
-  @Test
+  @TestTemplate
   public void rewriteFunctionIdentifier() {
     assumeThat(catalogName)
         .as("system namespace doesn't exist in SparkSessionCatalog")
@@ -623,7 +627,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactly(row(IcebergBuild.version()));
   }
 
-  @Test
+  @TestTemplate
   public void builtinFunctionIdentifierNotRewritten() {
     String viewName = viewName("builtinFunctionIdentifierNotRewritten");
     String sql = "SELECT trim('  abc   ') AS result";
@@ -642,7 +646,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SELECT * FROM %s", 
viewName)).hasSize(1).containsExactly(row("abc"));
   }
 
-  @Test
+  @TestTemplate
   public void rewriteFunctionIdentifierWithNamespace() {
     assumeThat(catalogName)
         .as("system namespace doesn't exist in SparkSessionCatalog")
@@ -671,7 +675,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactly(row(50, "a"));
   }
 
-  @Test
+  @TestTemplate
   public void fullFunctionIdentifier() {
     assumeThat(catalogName)
         .as("system namespace doesn't exist in SparkSessionCatalog")
@@ -698,7 +702,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactly(row(50, "a"));
   }
 
-  @Test
+  @TestTemplate
   public void fullFunctionIdentifierNotRewrittenLoadFailure() {
     String viewName = 
viewName("fullFunctionIdentifierNotRewrittenLoadFailure");
     String sql = "SELECT spark_catalog.system.bucket(100, 'a') AS 
bucket_result, 'a' AS value";
@@ -743,7 +747,7 @@ public class TestViews extends SparkExtensionsTestBase {
     return Spark3Util.loadIcebergCatalog(spark, catalogName);
   }
 
-  @Test
+  @TestTemplate
   public void renameView() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("originalView");
@@ -769,7 +773,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrderElementsOf(expected);
   }
 
-  @Test
+  @TestTemplate
   public void renameViewHiddenByTempView() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("originalView");
@@ -808,7 +812,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(viewCatalog.viewExists(TableIdentifier.of(NAMESPACE, 
renamedView))).isTrue();
   }
 
-  @Test
+  @TestTemplate
   public void renameViewToDifferentTargetCatalog() {
     String viewName = viewName("originalView");
     String renamedView = viewName("renamedView");
@@ -839,14 +843,14 @@ public class TestViews extends SparkExtensionsTestBase {
             "Cannot move view between catalogs: from=%s and to=%s", 
catalogName, targetCatalog);
   }
 
-  @Test
+  @TestTemplate
   public void renameNonExistingView() {
     assertThatThrownBy(() -> sql("ALTER VIEW non_existing RENAME TO target"))
         .isInstanceOf(AnalysisException.class)
         .hasMessageContaining("The table or view `non_existing` cannot be 
found");
   }
 
-  @Test
+  @TestTemplate
   public void renameViewTargetAlreadyExistsAsView() {
     String viewName = viewName("renameViewSource");
     String target = viewName("renameViewTarget");
@@ -876,7 +880,7 @@ public class TestViews extends SparkExtensionsTestBase {
             String.format("Cannot create view default.%s because it already 
exists", target));
   }
 
-  @Test
+  @TestTemplate
   public void renameViewTargetAlreadyExistsAsTable() {
     String viewName = viewName("renameViewSource");
     String target = viewName("renameViewTarget");
@@ -901,7 +905,7 @@ public class TestViews extends SparkExtensionsTestBase {
             String.format("Cannot create view default.%s because it already 
exists", target));
   }
 
-  @Test
+  @TestTemplate
   public void dropView() {
     String viewName = viewName("viewToBeDropped");
     String sql = String.format("SELECT id FROM %s", tableName);
@@ -923,14 +927,14 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(viewCatalog.viewExists(identifier)).isFalse();
   }
 
-  @Test
+  @TestTemplate
   public void dropNonExistingView() {
     assertThatThrownBy(() -> sql("DROP VIEW non_existing"))
         .isInstanceOf(AnalysisException.class)
         .hasMessageContaining("The view %s.%s cannot be found", NAMESPACE, 
"non_existing");
   }
 
-  @Test
+  @TestTemplate
   public void dropViewIfExists() {
     String viewName = viewName("viewToBeDropped");
     String sql = String.format("SELECT id FROM %s", tableName);
@@ -955,7 +959,7 @@ public class TestViews extends SparkExtensionsTestBase {
   }
 
   /** The purpose of this test is mainly to make sure that normal view 
deletion isn't messed up */
-  @Test
+  @TestTemplate
   public void dropGlobalTempView() {
     String globalTempView = viewName("globalViewToBeDropped");
     sql("CREATE GLOBAL TEMPORARY VIEW %s AS SELECT id FROM %s", 
globalTempView, tableName);
@@ -966,7 +970,7 @@ public class TestViews extends SparkExtensionsTestBase {
   }
 
   /** The purpose of this test is mainly to make sure that normal view 
deletion isn't messed up */
-  @Test
+  @TestTemplate
   public void dropTempView() {
     String tempView = viewName("tempViewToBeDropped");
     sql("CREATE TEMPORARY VIEW %s AS SELECT id FROM %s", tempView, tableName);
@@ -984,7 +988,7 @@ public class TestViews extends SparkExtensionsTestBase {
     return viewName + new Random().nextInt(1000000);
   }
 
-  @Test
+  @TestTemplate
   public void createViewIfNotExists() {
     String viewName = viewName("viewThatAlreadyExists");
     sql("CREATE VIEW %s AS SELECT id FROM %s", viewName, tableName);
@@ -1001,7 +1005,7 @@ public class TestViews extends SparkExtensionsTestBase {
             () -> sql("CREATE VIEW IF NOT EXISTS %s AS SELECT id FROM %s", 
viewName, tableName));
   }
 
-  @Test
+  @TestTemplate
   public void createOrReplaceView() throws NoSuchTableException {
     insertRows(6);
     String viewName = viewName("simpleView");
@@ -1017,14 +1021,14 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrder(row(4), row(5), row(6));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithInvalidSQL() {
     assertThatThrownBy(() -> sql("CREATE VIEW simpleViewWithInvalidSQL AS 
invalid SQL"))
         .isInstanceOf(AnalysisException.class)
         .hasMessageContaining("Syntax error");
   }
 
-  @Test
+  @TestTemplate
   public void createViewReferencingTempView() throws NoSuchTableException {
     insertRows(10);
     String tempView = viewName("temporaryViewBeingReferencedInAnotherView");
@@ -1043,7 +1047,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(tempView);
   }
 
-  @Test
+  @TestTemplate
   public void createViewReferencingGlobalTempView() throws 
NoSuchTableException {
     insertRows(10);
     String globalTempView = viewName("globalTemporaryViewBeingReferenced");
@@ -1067,7 +1071,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(String.format("%s.%s", "global_temp", 
globalTempView));
   }
 
-  @Test
+  @TestTemplate
   public void createViewReferencingTempFunction() {
     String viewName = viewName("viewReferencingTemporaryFunction");
     String functionName = viewName("test_avg_func");
@@ -1086,7 +1090,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(functionName);
   }
 
-  @Test
+  @TestTemplate
   public void createViewReferencingQualifiedTempFunction() {
     String viewName = viewName("viewReferencingTemporaryFunction");
     String functionName = viewName("test_avg_func_qualified");
@@ -1117,7 +1121,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(String.format("`%s`.`%s`", NAMESPACE, 
functionName));
   }
 
-  @Test
+  @TestTemplate
   public void createViewUsingNonExistingTable() {
     assertThatThrownBy(
             () -> sql("CREATE VIEW viewWithNonExistingTable AS SELECT id FROM 
non_existing"))
@@ -1125,7 +1129,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("The table or view `non_existing` cannot be 
found");
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithMismatchedColumnCounts() {
     String viewName = viewName("viewWithMismatchedColumnCounts");
 
@@ -1148,7 +1152,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("Data columns: id, data");
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithColumnAliases() throws NoSuchTableException {
     insertRows(6);
     String viewName = viewName("viewWithColumnAliases");
@@ -1184,7 +1188,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrder(row(1), row(2), row(3));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithDuplicateColumnNames() {
     assertThatThrownBy(
             () ->
@@ -1195,7 +1199,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("The column `new_id` already exists");
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithDuplicateQueryColumnNames() throws 
NoSuchTableException {
     insertRows(3);
     String viewName = viewName("viewWithDuplicateQueryColumnNames");
@@ -1213,7 +1217,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactlyInAnyOrder(row(1, 1), row(2, 2), row(3, 3));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithCTE() throws NoSuchTableException {
     insertRows(10);
     String viewName = viewName("simpleViewWithCTE");
@@ -1228,7 +1232,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SELECT * FROM %s", 
viewName)).hasSize(1).containsExactly(row(10, 1L));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithConflictingNamesForCTEAndTempView() throws 
NoSuchTableException {
     insertRows(10);
     String viewName = viewName("viewWithConflictingNamesForCTEAndTempView");
@@ -1247,7 +1251,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SELECT * FROM %s", 
viewName)).hasSize(1).containsExactly(row(10, 1L));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithCTEReferencingTempView() {
     String viewName = viewName("viewWithCTEReferencingTempView");
     String tempViewInCTE = viewName("tempViewInCTE");
@@ -1267,7 +1271,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(tempViewInCTE);
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithCTEReferencingTempFunction() {
     String viewName = viewName("viewWithCTEReferencingTempFunction");
     String functionName = viewName("avg_function_in_cte");
@@ -1289,7 +1293,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(functionName);
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithNonExistingQueryColumn() {
     assertThatThrownBy(
             () ->
@@ -1301,7 +1305,7 @@ public class TestViews extends SparkExtensionsTestBase {
             "A column or function parameter with name `non_existing` cannot be 
resolved");
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithSubqueryExpressionUsingTempView() {
     String viewName = viewName("viewWithSubqueryExpression");
     String tempView = viewName("simpleTempView");
@@ -1318,7 +1322,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(tempView);
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithSubqueryExpressionUsingGlobalTempView() {
     String viewName = viewName("simpleViewWithSubqueryExpression");
     String globalTempView = viewName("simpleGlobalTempView");
@@ -1339,7 +1343,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(String.format("%s.%s", "global_temp", 
globalTempView));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithSubqueryExpressionUsingTempFunction() {
     String viewName = viewName("viewWithSubqueryExpression");
     String functionName = viewName("avg_function_in_subquery");
@@ -1360,7 +1364,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining(functionName);
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithSubqueryExpressionInFilterThatIsRewritten()
       throws NoSuchTableException {
     insertRows(5);
@@ -1387,7 +1391,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactly(row(5));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithSubqueryExpressionInQueryThatIsRewritten() throws 
NoSuchTableException {
     insertRows(3);
     String viewName = viewName("viewWithSubqueryExpression");
@@ -1414,7 +1418,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactly(row(3), row(3), row(3));
   }
 
-  @Test
+  @TestTemplate
   public void describeView() {
     String viewName = viewName("describeView");
 
@@ -1423,7 +1427,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsExactly(row("id", "int", ""), row("data", "string", ""));
   }
 
-  @Test
+  @TestTemplate
   public void describeExtendedView() {
     String viewName = viewName("describeExtendedView");
     String sql = String.format("SELECT id, data FROM %s WHERE id <= 3", 
tableName);
@@ -1449,7 +1453,7 @@ public class TestViews extends SparkExtensionsTestBase {
                 ""));
   }
 
-  @Test
+  @TestTemplate
   public void createAndDescribeViewInDefaultNamespace() {
     String viewName = viewName("createViewInDefaultNamespace");
     String sql = String.format("SELECT id, data FROM %s WHERE id <= 3", 
tableName);
@@ -1479,7 +1483,7 @@ public class TestViews extends SparkExtensionsTestBase {
                 ""));
   }
 
-  @Test
+  @TestTemplate
   public void createAndDescribeViewWithoutCurrentNamespace() {
     String viewName = viewName("createViewWithoutCurrentNamespace");
     Namespace namespace = Namespace.of("test_namespace");
@@ -1511,7 +1515,7 @@ public class TestViews extends SparkExtensionsTestBase {
                 ""));
   }
 
-  @Test
+  @TestTemplate
   public void showViewProperties() {
     String viewName = viewName("showViewProps");
 
@@ -1522,7 +1526,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .contains(row("key1", "val1"), row("key2", "val2"));
   }
 
-  @Test
+  @TestTemplate
   public void showViewPropertiesByKey() {
     String viewName = viewName("showViewPropsByKey");
 
@@ -1541,7 +1545,7 @@ public class TestViews extends SparkExtensionsTestBase {
                     catalogName, NAMESPACE, viewName)));
   }
 
-  @Test
+  @TestTemplate
   public void showViews() throws NoSuchTableException {
     insertRows(6);
     String sql = String.format("SELECT * from %s", tableName);
@@ -1598,7 +1602,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SHOW VIEWS IN default")).contains(tempView);
   }
 
-  @Test
+  @TestTemplate
   public void showViewsWithCurrentNamespace() {
     String namespaceOne = "show_views_ns1";
     String namespaceTwo = "show_views_ns2";
@@ -1629,7 +1633,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SHOW VIEWS LIKE 
'viewTwo*'")).contains(v2).doesNotContain(v1);
   }
 
-  @Test
+  @TestTemplate
   public void showCreateSimpleView() {
     String viewName = viewName("showCreateSimpleView");
     String sql = String.format("SELECT id, data FROM %s WHERE id <= 3", 
tableName);
@@ -1651,7 +1655,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SHOW CREATE TABLE %s", 
viewName)).containsExactly(row(expected));
   }
 
-  @Test
+  @TestTemplate
   public void showCreateComplexView() {
     String viewName = viewName("showCreateComplexView");
     String sql = String.format("SELECT id, data FROM %s WHERE id <= 3", 
tableName);
@@ -1679,7 +1683,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(sql("SHOW CREATE TABLE %s", 
viewName)).containsExactly(row(expected));
   }
 
-  @Test
+  @TestTemplate
   public void alterViewSetProperties() {
     String viewName = viewName("viewWithSetProperties");
 
@@ -1701,7 +1705,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsEntry("comment", "view comment");
   }
 
-  @Test
+  @TestTemplate
   public void alterViewSetReservedProperties() {
     String viewName = viewName("viewWithSetReservedProperties");
 
@@ -1732,7 +1736,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("Cannot set reserved property: 
'spark.query-column-names'");
   }
 
-  @Test
+  @TestTemplate
   public void alterViewUnsetProperties() {
     String viewName = viewName("viewWithUnsetProperties");
     sql("CREATE VIEW %s AS SELECT id FROM %s WHERE id <= 3", viewName, 
tableName);
@@ -1753,7 +1757,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .containsEntry("comment", "view comment");
   }
 
-  @Test
+  @TestTemplate
   public void alterViewUnsetUnknownProperty() {
     String viewName = viewName("viewWithUnsetUnknownProp");
     sql("CREATE VIEW %s AS SELECT id FROM %s WHERE id <= 3", viewName, 
tableName);
@@ -1767,7 +1771,7 @@ public class TestViews extends SparkExtensionsTestBase {
             () -> sql("ALTER VIEW %s UNSET TBLPROPERTIES IF EXISTS 
('unknown-key')", viewName));
   }
 
-  @Test
+  @TestTemplate
   public void alterViewUnsetReservedProperties() {
     String viewName = viewName("viewWithUnsetReservedProperties");
 
@@ -1803,7 +1807,7 @@ public class TestViews extends SparkExtensionsTestBase {
         .hasMessageContaining("Cannot unset reserved property: 
'spark.query-column-names'");
   }
 
-  @Test
+  @TestTemplate
   public void createOrReplaceViewWithColumnAliases() throws 
NoSuchTableException {
     insertRows(6);
     String viewName = viewName("viewWithColumnAliases");
@@ -1849,7 +1853,7 @@ public class TestViews extends SparkExtensionsTestBase {
     assertThat(second.doc()).isEqualTo("new ID");
   }
 
-  @Test
+  @TestTemplate
   public void alterViewIsNotSupported() throws NoSuchTableException {
     insertRows(6);
     String viewName = viewName("alteredView");
@@ -1867,7 +1871,7 @@ public class TestViews extends SparkExtensionsTestBase {
             "ALTER VIEW <viewName> AS is not supported. Use CREATE OR REPLACE 
VIEW instead");
   }
 
-  @Test
+  @TestTemplate
   public void createOrReplaceViewKeepsViewHistory() {
     String viewName = viewName("viewWithHistoryAfterReplace");
     String sql = String.format("SELECT id, data FROM %s WHERE id <= 3", 
tableName);
@@ -1906,7 +1910,7 @@ public class TestViews extends SparkExtensionsTestBase {
                 .asStruct());
   }
 
-  @Test
+  @TestTemplate
   public void replacingTrinoViewShouldFail() {
     String viewName = viewName("trinoView");
     String sql = String.format("SELECT id FROM %s", tableName);
@@ -1929,7 +1933,7 @@ public class TestViews extends SparkExtensionsTestBase {
                 + "New dialects: [spark]");
   }
 
-  @Test
+  @TestTemplate
   public void replacingTrinoAndSparkViewShouldFail() {
     String viewName = viewName("trinoAndSparkView");
     String sql = String.format("SELECT id FROM %s", tableName);
@@ -1953,7 +1957,7 @@ public class TestViews extends SparkExtensionsTestBase {
                 + "New dialects: [spark]");
   }
 
-  @Test
+  @TestTemplate
   public void replacingViewWithDialectDropAllowed() {
     String viewName = viewName("trinoView");
     String sql = String.format("SELECT id FROM %s", tableName);
@@ -2002,7 +2006,7 @@ public class TestViews extends SparkExtensionsTestBase {
         
.isEqualTo(ImmutableSQLViewRepresentation.builder().dialect("spark").sql(sql).build());
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithRecursiveCycle() {
     String viewOne = viewName("viewOne");
     String viewTwo = viewName("viewTwo");
@@ -2021,7 +2025,7 @@ public class TestViews extends SparkExtensionsTestBase {
             String.format("Recursive cycle in view detected: %s (cycle: %s)", 
view1, cycle));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithRecursiveCycleToV1View() {
     assumeThat(catalogName).isNotEqualTo(SPARK_CATALOG);
     String viewOne = viewName("view_one");
@@ -2043,7 +2047,7 @@ public class TestViews extends SparkExtensionsTestBase {
             String.format("Recursive cycle in view detected: %s (cycle: %s)", 
view1, cycle));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithRecursiveCycleInCTE() {
     String viewOne = viewName("viewOne");
     String viewTwo = viewName("viewTwo");
@@ -2068,7 +2072,7 @@ public class TestViews extends SparkExtensionsTestBase {
             String.format("Recursive cycle in view detected: %s (cycle: %s)", 
view1, cycle));
   }
 
-  @Test
+  @TestTemplate
   public void createViewWithRecursiveCycleInSubqueryExpression() {
     String viewOne = viewName("viewOne");
     String viewTwo = viewName("viewTwo");
@@ -2090,10 +2094,11 @@ public class TestViews extends SparkExtensionsTestBase {
             String.format("Recursive cycle in view detected: %s (cycle: %s)", 
view1, cycle));
   }
 
-  @Test
-  public void createViewWithCustomMetadataLocation() throws IOException {
+  @TestTemplate
+  public void createViewWithCustomMetadataLocation() {
     String viewName = viewName("v");
-    String customMetadataLocation = 
temp.newFolder("custom-metadata-location").toString();
+    String customMetadataLocation =
+        Paths.get(temp.toUri().toString(), 
"custom-metadata-location").toString();
     sql(
         "CREATE VIEW %s TBLPROPERTIES ('%s'='%s') AS SELECT * FROM %s",
         viewName, ViewProperties.WRITE_METADATA_LOCATION, 
customMetadataLocation, tableName);
diff --git 
a/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
 
b/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
index 7bbfc29e0a..4a8b5cfc3e 100644
--- 
a/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
+++ 
b/spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteTablePathProcedure.java
@@ -20,6 +20,7 @@ package org.apache.iceberg.spark.extensions;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.atIndex;
 
 import java.nio.file.Path;
 import java.util.List;
@@ -101,11 +102,13 @@ public class TestRewriteTablePathProcedure extends 
ExtensionsTestBase {
             v1Metadata,
             v0Metadata,
             stagingLocation);
-    assertThat(result).hasSize(1);
-    assertThat(result.get(0)[0]).as("Should return correct latest 
version").isEqualTo(v1Metadata);
-    assertThat(result.get(0)[1])
-        .as("Should return correct file_list_location")
-        .isEqualTo(expectedFileListLocation);
+    assertThat(result)
+        .singleElement()
+        .satisfies(
+            objects -> {
+              assertThat(objects).contains(v1Metadata, atIndex(0));
+              assertThat(objects).contains(expectedFileListLocation, 
atIndex(1));
+            });
     checkFileListLocationCount((String) result.get(0)[1], 4);
   }
 

Reply via email to