You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2022/03/15 10:07:37 UTC

[flink] branch release-1.14 updated: [FLINK-25771][cassandra][tests] Remove keyspace drop

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

chesnay pushed a commit to branch release-1.14
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.14 by this push:
     new e0aae11  [FLINK-25771][cassandra][tests] Remove keyspace drop
e0aae11 is described below

commit e0aae1159ff83cf1717387fae5ced8555084d832
Author: Etienne Chauchot <ec...@apache.org>
AuthorDate: Tue Mar 15 11:01:10 2022 +0100

    [FLINK-25771][cassandra][tests] Remove keyspace drop
    
    Since each test uses a separate table we no longer need to re-create the keyspace for each run, reducing the load on the cluster.
---
 .../cassandra/CassandraConnectorITCase.java           | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java b/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java
index 924c684..de14e86 100644
--- a/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java
+++ b/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java
@@ -62,7 +62,6 @@ import com.datastax.driver.mapping.annotations.Table;
 import net.bytebuddy.ByteBuddy;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
@@ -165,9 +164,6 @@ public class CassandraConnectorITCase
             "CREATE KEYSPACE "
                     + KEYSPACE
                     + " WITH replication= {'class':'SimpleStrategy', 'replication_factor':1};";
-    private static final String DROP_KEYSPACE_QUERY = "DROP KEYSPACE IF EXISTS " + KEYSPACE + " ;";
-    private static final String DROP_TABLE_QUERY =
-            "DROP TABLE IF EXISTS " + KEYSPACE + "." + TABLE_NAME_VARIABLE + " ;";
     private static final String CREATE_TABLE_QUERY =
             "CREATE TABLE "
                     + KEYSPACE
@@ -386,10 +382,7 @@ public class CassandraConnectorITCase
                 }
             }
         }
-        session.execute(DROP_KEYSPACE_QUERY);
         session.execute(CREATE_KEYSPACE_QUERY);
-        session.execute(
-                CREATE_TABLE_QUERY.replace(TABLE_NAME_VARIABLE, TABLE_NAME_PREFIX + "initial"));
     }
 
     @Before
@@ -398,14 +391,6 @@ public class CassandraConnectorITCase
         session.execute(injectTableName(CREATE_TABLE_QUERY));
     }
 
-    @After
-    public void dropTables() {
-        // need to drop tables in case of retrials. Need to drop all the tables
-        // that are created in test because this method is executed with every test
-        session.execute(DROP_KEYSPACE_QUERY);
-        session.execute(CREATE_KEYSPACE_QUERY);
-    }
-
     @AfterClass
     public static void closeCassandra() {
         if (session != null) {
@@ -722,9 +707,7 @@ public class CassandraConnectorITCase
     private static int retrialsCount = 0;
 
     @Test
-    public void testRetrialAndDropTables() {
-        // should not fail with table exists upon retrial
-        // as @After method that truncate the keyspace is called upon retrials.
+    public void testRetrial() {
         annotatePojoWithTable(KEYSPACE, TABLE_NAME_PREFIX + tableID);
         if (retrialsCount < 2) {
             retrialsCount++;