Skip to content

Commit

Permalink
Move testDropTable to BaseConnectorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
hashhar committed Apr 26, 2022
1 parent 96a5286 commit 7d9ea60
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
import static java.util.Locale.ENGLISH;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

public class TestBigQueryConnectorTest
extends BaseConnectorTest
Expand Down Expand Up @@ -246,17 +244,6 @@ public void testCreateTableAsSelectWithUnicode()
.hasStackTraceContaining("This connector does not support creating tables with data");
}

@Test
public void testDropTable()
{
String tableName = "test_drop_table_" + randomTableSuffix();
assertUpdate("CREATE TABLE " + tableName + "(col bigint)");
assertTrue(getQueryRunner().tableExists(getSession(), tableName));

assertUpdate("DROP TABLE " + tableName);
assertFalse(getQueryRunner().tableExists(getSession(), tableName));
}

@Test
@Override
public void testRenameTable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ public void testCreateTable()
throw new SkipException("TODO");
}

@Override
public void testDropTable()
{
assertThatThrownBy(super::testDropTable)
.hasMessage("Table partitioning must be specified using setRangePartitionColumns or addHashPartitions");
throw new SkipException("TODO Enable the test once Kudu connector can create tables with default partitions");
}

@Override
protected String tableDefinitionForAddColumn()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

public abstract class BaseMariaDbConnectorTest
extends BaseJdbcConnectorTest
Expand Down Expand Up @@ -170,16 +168,6 @@ public void testShowCreateTable()
")");
}

@Test
public void testDropTable()
{
assertUpdate("CREATE TABLE test_drop AS SELECT 123 x", 1);
assertTrue(getQueryRunner().tableExists(getSession(), "test_drop"));

assertUpdate("DROP TABLE test_drop");
assertFalse(getQueryRunner().tableExists(getSession(), "test_drop"));
}

@Test
public void testViews()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,6 @@ public void testSelectView()
assertUpdate("DROP TABLE test.view_base");
}

@Test
public void testDropTable()
{
assertUpdate("CREATE TABLE test.drop_table(col bigint)");
assertUpdate("DROP TABLE test.drop_table");
assertQueryFails("SELECT * FROM test.drop_table", ".*Table 'mongodb.test.drop_table' does not exist");
}

@Test
public void testBooleanPredicates()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,6 @@ public void testShowCreateTable()
")");
}

@Test
public void testDropTable()
{
assertUpdate("CREATE TABLE test_drop AS SELECT 123 x", 1);
assertTrue(getQueryRunner().tableExists(getSession(), "test_drop"));

assertUpdate("DROP TABLE test_drop");
assertFalse(getQueryRunner().tableExists(getSession(), "test_drop"));
}

@Override
public void testDeleteWithLike()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
import static java.util.Locale.ENGLISH;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

public abstract class BaseOracleConnectorTest
extends BaseJdbcConnectorTest
Expand Down Expand Up @@ -307,17 +305,6 @@ protected TestTable createAggregationTestTable(String name, List<String> rows)
return new TestTable(onRemoteDatabase(), name, "(short_decimal number(9, 3), long_decimal number(30, 10), a_bigint number(19), t_double binary_double)", rows);
}

@Test
public void testDropTable()
{
String tableName = "test_drop" + randomTableSuffix();
assertUpdate(format("CREATE TABLE %s AS SELECT 1 test_drop", tableName), 1);
assertTrue(getQueryRunner().tableExists(getSession(), tableName));

assertUpdate("DROP TABLE " + tableName);
assertFalse(getQueryRunner().tableExists(getSession(), tableName));
}

@Override
public void testDeleteWithLike()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
import static java.util.stream.Collectors.joining;
import static java.util.stream.IntStream.range;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

public class TestPostgreSqlConnectorTest
Expand Down Expand Up @@ -163,16 +162,6 @@ protected TestTable createTableWithUnsupportedColumn()
"(one bigint, two decimal(50,0), three varchar(10))");
}

@Test
public void testDropTable()
{
assertUpdate("CREATE TABLE test_drop AS SELECT 123 x", 1);
assertTrue(getQueryRunner().tableExists(getSession(), "test_drop"));

assertUpdate("DROP TABLE test_drop");
assertFalse(getQueryRunner().tableExists(getSession(), "test_drop"));
}

@Test
public void testViews()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,6 @@ public void testInsertHighestUnicodeCharacter()
throw new SkipException("SingleStore doesn't support utf8mb4");
}

@Test
public void testDropTable()
{
assertUpdate("CREATE TABLE test_drop AS SELECT 123 x", 1);
assertTrue(getQueryRunner().tableExists(getSession(), "test_drop"));

assertUpdate("DROP TABLE test_drop");
assertFalse(getQueryRunner().tableExists(getSession(), "test_drop"));
}

@Override
public void testDeleteWithLike()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,18 @@ protected void verifyConcurrentUpdateFailurePermissible(Exception e)
throw new AssertionError("Unexpected concurrent update failure", e);
}

@Test
public void testDropTable()
{
skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE));
String tableName = "test_drop_table_" + randomTableSuffix();
assertUpdate("CREATE TABLE " + tableName + "(col bigint)");
assertTrue(getQueryRunner().tableExists(getSession(), tableName));

assertUpdate("DROP TABLE " + tableName);
assertFalse(getQueryRunner().tableExists(getSession(), tableName));
}

@Test
public void testDropTableIfExists()
{
Expand Down

0 comments on commit 7d9ea60

Please sign in to comment.