Skip to content

Commit

Permalink
Use randomTableSuffix() in BaseTestMySqlTableStatisticsTest tests
Browse files Browse the repository at this point in the history
When increasing @test(invocationCount = X) to reproduce @flaky tests,
having a unique table name is important for test isolation.
  • Loading branch information
leveyja authored and findepi committed May 20, 2022
1 parent 9549957 commit d2cbe9d
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import static com.google.common.collect.Streams.stream;
import static io.trino.plugin.mysql.MySqlQueryRunner.createMySqlQueryRunner;
import static io.trino.testing.sql.TestTable.fromColumns;
import static io.trino.testing.sql.TestTable.randomTableSuffix;
import static io.trino.tpch.TpchTable.ORDERS;
import static java.lang.Math.min;
import static java.lang.String.format;
Expand Down Expand Up @@ -87,7 +88,7 @@ protected QueryRunner createQueryRunner()
match = "Expecting.*to be close to|ComparisonFailure.*NDV for")
public void testNotAnalyzed()
{
String tableName = "test_not_analyzed";
String tableName = "test_not_analyzed_" + randomTableSuffix();
assertUpdate("DROP TABLE IF EXISTS " + tableName);
computeActual(format("CREATE TABLE %s AS SELECT * FROM tpch.tiny.orders", tableName));
try {
Expand Down Expand Up @@ -119,7 +120,7 @@ public void testNotAnalyzed()
@Test
public void testBasic()
{
String tableName = "test_stats_orders";
String tableName = "test_stats_orders_" + randomTableSuffix();
assertUpdate("DROP TABLE IF EXISTS " + tableName);
computeActual(format("CREATE TABLE %s AS SELECT * FROM tpch.tiny.orders", tableName));
try {
Expand Down Expand Up @@ -147,7 +148,7 @@ public void testBasic()
@Test
public void testAllNulls()
{
String tableName = "test_stats_table_all_nulls";
String tableName = "test_stats_table_all_nulls_" + randomTableSuffix();
assertUpdate("DROP TABLE IF EXISTS " + tableName);
computeActual(format("CREATE TABLE %s AS SELECT orderkey, custkey, orderpriority, comment FROM tpch.tiny.orders WHERE false", tableName));
try {
Expand Down Expand Up @@ -196,7 +197,7 @@ public void testAllNulls()
@Test
public void testNullsFraction()
{
String tableName = "test_stats_table_with_nulls";
String tableName = "test_stats_table_with_nulls_" + randomTableSuffix();
assertUpdate("DROP TABLE IF EXISTS " + tableName);
assertUpdate("" +
"CREATE TABLE " + tableName + " AS " +
Expand Down Expand Up @@ -246,7 +247,7 @@ public void testPartitionedTable()
@Test
public void testView()
{
String tableName = "test_stats_view";
String tableName = "test_stats_view_" + randomTableSuffix();
executeInMysql("CREATE OR REPLACE VIEW " + tableName + " AS SELECT orderkey, custkey, orderpriority, comment FROM orders");
try {
assertQuery(
Expand Down

0 comments on commit d2cbe9d

Please sign in to comment.