Skip to content

Commit

Permalink
disable rf uptuning for failing tests
Browse files Browse the repository at this point in the history
To ensure that the related tests can relably check their assertions,
the replication factor uptuning is disabled in the test class setup.
  • Loading branch information
tilman-aiven committed Jul 1, 2024
1 parent 0f55684 commit 673ab9f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unit/org/apache/cassandra/cql3/PreparedStatementsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
import java.util.stream.Collectors;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.exceptions.SyntaxError;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.ConsistencyLevel;
import org.apache.cassandra.exceptions.PreparedQueryNotFoundException;
import org.apache.cassandra.index.StubIndex;
Expand All @@ -49,6 +51,18 @@ public class PreparedStatementsTest extends CQLTester
" WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };";
private static final String dropKsStatement = "DROP KEYSPACE IF EXISTS " + KEYSPACE;


/**
* Prevent the {@link org.apache.cassandra.cql3.statements.schema.TuneUpReplicationFactor} from
* uptuning the replication factor to ensure that the test can reliably check the assertions.
*/
@BeforeClass
public static void setUpClass()
{
DatabaseDescriptor.setUptuningEnabled(false);
CQLTester.setUpClass();
}

@Before
public void setup()
{
Expand Down
2 changes: 2 additions & 0 deletions test/unit/org/apache/cassandra/triggers/TriggersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;

import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.schema.Schema;
import org.apache.cassandra.cql3.QueryProcessor;
import org.apache.cassandra.cql3.UntypedResultSet;
Expand Down Expand Up @@ -59,6 +60,7 @@ public static void beforeTest() throws ConfigurationException
public void setup() throws Exception
{
StorageService.instance.initServer(0);
DatabaseDescriptor.setUptuningEnabled(false);

String cql = String.format("CREATE KEYSPACE IF NOT EXISTS %s " +
"WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1}",
Expand Down

0 comments on commit 673ab9f

Please sign in to comment.