Skip to content

Commit

Permalink
Migrate to skipTestUnless
Browse files Browse the repository at this point in the history
  • Loading branch information
hashhar committed Jul 9, 2021
1 parent 8d122b2 commit 4bbcb74
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import static io.trino.testing.TestingConnectorBehavior.SUPPORTS_LIMIT_PUSHDOWN;
import static io.trino.testing.TestingConnectorBehavior.SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY;
import static io.trino.testing.TestingConnectorBehavior.SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY;
import static io.trino.testing.TestingConnectorBehavior.SUPPORTS_ROW_LEVEL_DELETE;
import static io.trino.testing.TestingConnectorBehavior.SUPPORTS_TOPN_PUSHDOWN;
import static io.trino.testing.TestingConnectorBehavior.SUPPORTS_TOPN_PUSHDOWN_WITH_VARCHAR;
import static io.trino.testing.assertions.Assert.assertEventually;
Expand Down Expand Up @@ -1169,7 +1170,7 @@ protected TestView createSleepingView(Duration minimalSleepDuration)
@Test
public void testDeleteWithBigintEqualityPredicate()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
String tableName = "test_delete_" + randomTableSuffix();
assertUpdate("CREATE TABLE " + tableName + " AS SELECT * FROM region", 5);
assertUpdate("DELETE FROM " + tableName + " WHERE regionkey = 1", 1);
Expand All @@ -1186,7 +1187,7 @@ public void testDeleteWithBigintEqualityPredicate()
@Test
public void testDeleteWithVarcharEqualityPredicate()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete", "(col varchar(1))", ImmutableList.of("'a'", "'A'", "null"))) {
if (!hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY)) {
assertQueryFails("DELETE FROM " + table.getName() + " WHERE col = 'A'", "Unsupported delete");
Expand All @@ -1201,7 +1202,7 @@ public void testDeleteWithVarcharEqualityPredicate()
@Test
public void testDeleteWithVarcharInequalityPredicate()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete", "(col varchar(1))", ImmutableList.of("'a'", "'A'", "null"))) {
if (!hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY)) {
assertQueryFails("DELETE FROM " + table.getName() + " WHERE col != 'A'", "Unsupported delete");
Expand All @@ -1216,7 +1217,7 @@ public void testDeleteWithVarcharInequalityPredicate()
@Test
public void testDeleteWithVarcharGreaterAndLowerPredicate()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_delete", "(col varchar(1))", ImmutableList.of("'0'", "'a'", "'A'", "'b'", "null"))) {
if (!hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY)) {
assertQueryFails("DELETE FROM " + table.getName() + " WHERE col < 'A'", "Unsupported delete");
Expand All @@ -1234,23 +1235,23 @@ public void testDeleteWithVarcharGreaterAndLowerPredicate()
@Override
public void testDeleteWithComplexPredicate()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
assertThatThrownBy(super::testDeleteWithComplexPredicate)
.hasStackTraceContaining("TrinoException: Unsupported delete");
}

@Override
public void testDeleteWithSubquery()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
assertThatThrownBy(super::testDeleteWithSubquery)
.hasStackTraceContaining("TrinoException: Unsupported delete");
}

@Override
public void testDeleteWithSemiJoin()
{
skipTestUnlessSupportsDeletes();
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE) && hasBehavior(SUPPORTS_ROW_LEVEL_DELETE));
assertThatThrownBy(super::testDeleteWithSemiJoin)
.hasStackTraceContaining("TrinoException: Unsupported delete");
}
Expand Down

0 comments on commit 4bbcb74

Please sign in to comment.