Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@

import io.trino.operator.RetryPolicy;
import io.trino.testing.BaseFailureRecoveryTest;
import org.testng.SkipException;
import org.junit.jupiter.api.Test;

import java.util.Optional;

import static io.trino.spi.connector.ConnectorMetadata.MODIFYING_ROWS_MESSAGE;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assumptions.abort;

public abstract class BaseJdbcFailureRecoveryTest
extends BaseFailureRecoveryTest
Expand All @@ -30,13 +31,15 @@ public BaseJdbcFailureRecoveryTest(RetryPolicy retryPolicy)
super(retryPolicy);
}

@Test
@Override
protected void testAnalyzeTable()
{
assertThatThrownBy(super::testAnalyzeTable).hasMessageMatching("This connector does not support analyze");
throw new SkipException("skipped");
abort("skipped");
}

@Test
@Override
protected void testDelete()
{
Expand All @@ -52,40 +55,45 @@ protected void testDelete()
.isCoordinatorOnly();
}

@Test
@Override
protected void testDeleteWithSubquery()
{
assertThatThrownBy(super::testDeleteWithSubquery).hasMessageContaining(MODIFYING_ROWS_MESSAGE);
throw new SkipException("skipped");
abort("skipped");
}

@Test
@Override
protected void testRefreshMaterializedView()
{
assertThatThrownBy(super::testRefreshMaterializedView)
.hasMessageContaining("This connector does not support creating materialized views");
throw new SkipException("skipped");
abort("skipped");
}

@Test
@Override
protected void testUpdate()
{
assertThatThrownBy(super::testUpdate).hasMessageContaining(MODIFYING_ROWS_MESSAGE);
throw new SkipException("skipped");
abort("skipped");
}

@Test
@Override
protected void testUpdateWithSubquery()
{
assertThatThrownBy(super::testUpdateWithSubquery).hasMessageContaining(MODIFYING_ROWS_MESSAGE);
throw new SkipException("skipped");
abort("skipped");
}

@Test
@Override
protected void testMerge()
{
assertThatThrownBy(super::testMerge).hasMessageContaining(MODIFYING_ROWS_MESSAGE);
throw new SkipException("skipped");
abort("skipped");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import io.trino.testing.BaseFailureRecoveryTest;
import io.trino.testing.QueryRunner;
import io.trino.tpch.TpchTable;
import org.testng.SkipException;

import java.util.List;
import java.util.Map;

import static org.junit.jupiter.api.Assumptions.abort;

public abstract class BaseBigQueryFailureRecoveryTest
extends BaseFailureRecoveryTest
{
Expand Down Expand Up @@ -62,48 +63,48 @@ protected boolean areWriteRetriesSupported()
protected void testAnalyzeTable()
{
// This connector does not support analyze
throw new SkipException("skipped");
abort("skipped");
}

@Override
protected void testDelete()
{
// This connector does not support modifying table rows
throw new SkipException("skipped");
abort("skipped");
}

@Override
protected void testDeleteWithSubquery()
{
// This connector does not support modifying table rows
throw new SkipException("skipped");
abort("skipped");
}

@Override
protected void testMerge()
{
// This connector does not support modifying table rows
throw new SkipException("skipped");
abort("skipped");
}

@Override
protected void testRefreshMaterializedView()
{
// This connector does not support creating materialized views
throw new SkipException("skipped");
abort("skipped");
}

@Override
protected void testUpdate()
{
// This connector does not support modifying table rows
throw new SkipException("skipped");
abort("skipped");
}

@Override
protected void testUpdateWithSubquery()
{
// This connector does not support modifying table rows
throw new SkipException("skipped");
abort("skipped");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import io.trino.testing.DistributedQueryRunner;
import io.trino.testing.QueryRunner;
import io.trino.tpch.TpchTable;
import org.testng.annotations.DataProvider;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -92,16 +92,7 @@ protected boolean areWriteRetriesSupported()
return true;
}

@Override
@DataProvider(name = "parallelTests", parallel = true)
public Object[][] parallelTests()
{
return moreParallelTests(super.parallelTests(),
parallelTest("testCreatePartitionedTable", this::testCreatePartitionedTable),
parallelTest("testInsertIntoNewPartition", this::testInsertIntoNewPartition),
parallelTest("testInsertIntoExistingPartition", this::testInsertIntoExistingPartition));
}

@Test
@Override
protected void testDelete()
{
Expand Down Expand Up @@ -186,6 +177,7 @@ protected void testDelete()
}
}

@Test
@Override
protected void testUpdate()
{
Expand Down Expand Up @@ -269,6 +261,7 @@ protected void testUpdate()
}
}

@Test
@Override
// materialized views are currently not implemented by Delta connector
protected void testRefreshMaterializedView()
Expand All @@ -277,6 +270,7 @@ protected void testRefreshMaterializedView()
.hasMessageContaining("This connector does not support creating materialized views");
}

@Test
protected void testCreatePartitionedTable()
{
testTableModification(
Expand All @@ -285,6 +279,7 @@ protected void testCreatePartitionedTable()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testInsertIntoNewPartition()
{
testTableModification(
Expand All @@ -293,6 +288,7 @@ protected void testInsertIntoNewPartition()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testInsertIntoExistingPartition()
{
testTableModification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.trino.Session;
import io.trino.operator.RetryPolicy;
import io.trino.testing.ExtendedFailureRecoveryTest;
import org.testng.annotations.DataProvider;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -50,20 +50,7 @@ protected void createPartitionedLineitemTable(String tableName, List<String> col
getQueryRunner().execute(sql);
}

@Override
@DataProvider(name = "parallelTests", parallel = true)
public Object[][] parallelTests()
{
return moreParallelTests(super.parallelTests(),
parallelTest("testCreatePartitionedTable", this::testCreatePartitionedTable),
parallelTest("testInsertIntoNewPartition", this::testInsertIntoNewPartition),
parallelTest("testInsertIntoExistingPartition", this::testInsertIntoExistingPartition),
parallelTest("testInsertIntoNewPartitionBucketed", this::testInsertIntoNewPartitionBucketed),
parallelTest("testInsertIntoExistingPartitionBucketed", this::testInsertIntoExistingPartitionBucketed),
parallelTest("testReplaceExistingPartition", this::testReplaceExistingPartition),
parallelTest("testDeletePartitionWithSubquery", this::testDeletePartitionWithSubquery));
}

@Test
@Override
// delete is unsupported for non ACID tables
protected void testDelete()
Expand All @@ -72,6 +59,7 @@ protected void testDelete()
.hasMessageContaining(MODIFYING_NON_TRANSACTIONAL_TABLE_MESSAGE);
}

@Test
@Override
// delete is unsupported for non ACID tables
protected void testDeleteWithSubquery()
Expand All @@ -80,6 +68,7 @@ protected void testDeleteWithSubquery()
.hasMessageContaining(MODIFYING_NON_TRANSACTIONAL_TABLE_MESSAGE);
}

@Test
@Override
// update is unsupported for non ACID tables
protected void testUpdate()
Expand All @@ -88,6 +77,7 @@ protected void testUpdate()
.hasMessageContaining(MODIFYING_NON_TRANSACTIONAL_TABLE_MESSAGE);
}

@Test
@Override
// update is unsupported for non ACID tables
protected void testUpdateWithSubquery()
Expand All @@ -96,13 +86,15 @@ protected void testUpdateWithSubquery()
.hasMessageContaining(MODIFYING_NON_TRANSACTIONAL_TABLE_MESSAGE);
}

@Test
@Override
protected void testMerge()
{
assertThatThrownBy(super::testMerge)
.hasMessageContaining("Modifying Hive table rows is only supported for transactional tables");
}

@Test
@Override
// materialized views are currently not implemented by Hive connector
protected void testRefreshMaterializedView()
Expand All @@ -111,6 +103,7 @@ protected void testRefreshMaterializedView()
.hasMessageContaining("This connector does not support creating materialized views");
}

@Test
protected void testCreatePartitionedTable()
{
testTableModification(
Expand All @@ -119,6 +112,7 @@ protected void testCreatePartitionedTable()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testInsertIntoNewPartition()
{
testTableModification(
Expand All @@ -127,6 +121,7 @@ protected void testInsertIntoNewPartition()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testInsertIntoExistingPartition()
{
testTableModification(
Expand All @@ -135,6 +130,7 @@ protected void testInsertIntoExistingPartition()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testInsertIntoNewPartitionBucketed()
{
testTableModification(
Expand All @@ -143,6 +139,7 @@ protected void testInsertIntoNewPartitionBucketed()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testInsertIntoExistingPartitionBucketed()
{
testTableModification(
Expand All @@ -151,6 +148,7 @@ protected void testInsertIntoExistingPartitionBucketed()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testReplaceExistingPartition()
{
testTableModification(
Expand All @@ -162,6 +160,7 @@ protected void testReplaceExistingPartition()
Optional.of("DROP TABLE <table>"));
}

@Test
protected void testDeletePartitionWithSubquery()
{
assertThatThrownBy(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@
import io.trino.plugin.hive.s3.S3HiveQueryRunner;
import io.trino.testing.QueryRunner;
import io.trino.tpch.TpchTable;
import org.testng.annotations.AfterClass;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.parallel.Execution;

import java.util.List;
import java.util.Map;

import static io.trino.plugin.exchange.filesystem.containers.MinioStorage.getExchangeManagerProperties;
import static io.trino.testing.TestingNames.randomNameSuffix;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT;

@TestInstance(PER_CLASS)
@Execution(CONCURRENT)
public class TestHiveQueryFailureRecoveryTest
extends BaseHiveFailureRecoveryTest
{
Expand Down Expand Up @@ -64,7 +70,7 @@ protected QueryRunner createQueryRunner(
.build();
}

@AfterClass(alwaysRun = true)
@AfterAll
public void destroy()
throws Exception
{
Expand Down
Loading